{"id":51133672,"url":"https://github.com/trananhtung/numeric-range","last_synced_at":"2026-06-27T17:00:31.155Z","repository":{"id":366610754,"uuid":"1275961281","full_name":"trananhtung/numeric-range","owner":"trananhtung","description":"Parse and format compact integer-range strings like 1,3-5,7 (page ranges, CPU sets). Bidirectional, zero-dep, no_std.","archived":false,"fork":false,"pushed_at":"2026-06-22T14:46:39.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-22T16:16:52.834Z","etag":null,"topics":["cpuset","no-std","page-range","parser","range","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trananhtung.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-21T11:14:44.000Z","updated_at":"2026-06-22T14:48:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/trananhtung/numeric-range","commit_stats":null,"previous_names":["trananhtung/numeric-range"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/trananhtung/numeric-range","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trananhtung%2Fnumeric-range","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trananhtung%2Fnumeric-range/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trananhtung%2Fnumeric-range/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trananhtung%2Fnumeric-range/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trananhtung","download_url":"https://codeload.github.com/trananhtung/numeric-range/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trananhtung%2Fnumeric-range/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34780126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpuset","no-std","page-range","parser","range","rust"],"created_at":"2026-06-25T15:01:44.851Z","updated_at":"2026-06-25T15:01:45.841Z","avatar_url":"https://github.com/trananhtung.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# numeric-range\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n\n[![Crates.io](https://img.shields.io/crates/v/numeric-range.svg)](https://crates.io/crates/numeric-range)\n[![Documentation](https://docs.rs/numeric-range/badge.svg)](https://docs.rs/numeric-range)\n[![CI](https://github.com/trananhtung/numeric-range/actions/workflows/ci.yml/badge.svg)](https://github.com/trananhtung/numeric-range/actions/workflows/ci.yml)\n[![License](https://img.shields.io/crates/l/numeric-range.svg)](#license)\n[![no_std](https://img.shields.io/badge/no__std-yes-brightgreen.svg)](#no_std)\n\n**Parse and format compact integer-range strings** — the familiar `\"1,3-5,7\"`\nsyntax from print dialogs (page ranges), CPU affinity lists (`taskset`, cgroups),\nline selectors, and CLI flags. **Both directions**, zero dependencies, `#![no_std]`.\n\n```rust\nassert_eq!(numeric_range::parse(\"1,3-5,7\").unwrap(), vec![1, 3, 4, 5, 7]);\nassert_eq!(numeric_range::format(\u0026[1, 3, 4, 5, 7]), \"1,3-5,7\");\n```\n\n## Why numeric-range?\n\nRust's existing crates in this space are parse-only or restrictively licensed.\n`numeric-range` is a small, permissive (MIT/Apache-2.0), `no_std` crate that does\n**both** parse *and* compact-format, so you can round-trip a user's `--pages`\nflag, normalize a CPU set, or render a selection back to its shortest form.\n\n```toml\n[dependencies]\nnumeric-range = \"0.1\"\n```\n\n## API\n\n| Function | Behavior |\n| --- | --- |\n| `parse(\u0026str) -\u003e Result\u003cVec\u003cu64\u003e, ParseError\u003e` | `\"1,3-5,7\"` → `[1,3,4,5,7]` (input order preserved) |\n| `format(\u0026[u64]) -\u003e String` | `[5,3,4,1,7]` → `\"1,3-5,7\"` (sorted, de-duplicated, runs collapsed) |\n\n- Whitespace around numbers and separators is tolerated (`\"1, 3 - 5\"`).\n- Empty input parses to an empty `Vec`.\n- Errors: empty parts (`\"1,,2\"`), non-numbers (`\"a\"`, `\"+5\"`), malformed ranges\n  (`\"1-2-3\"`), descending ranges (`\"5-1\"`), and ranges that would expand beyond\n  10 million values (so a tiny untrusted string can't exhaust memory).\n- Values are unsigned (`u64`), matching page/CPU/line use cases.\n\n## no_std\n\n`numeric-range` is `#![no_std]` and only needs `alloc`. It builds for bare-metal\ntargets such as `thumbv7em-none-eabi`.\n\n## Contributors ✨\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the [emoji key](https://allcontributors.org/docs/en/emoji-key) for how each contribution is recognized, and open a PR or issue to get involved.\n\nThanks goes to these wonderful people:\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/trananhtung\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/30992229?v=4?s=100\" width=\"100px;\" alt=\"Tung Tran\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTung Tran\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/trananhtung/numeric-range/commits?author=trananhtung\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#maintenance-trananhtung\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## License\n\nLicensed under either of [Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) at\nyour option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrananhtung%2Fnumeric-range","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrananhtung%2Fnumeric-range","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrananhtung%2Fnumeric-range/lists"}