10 releases (6 breaking)
| 0.7.0 | Jan 30, 2026 |
|---|---|
| 0.6.0 | Aug 13, 2024 |
| 0.5.1 | Dec 20, 2023 |
| 0.5.0 | Nov 6, 2023 |
| 0.1.0 | Feb 25, 2022 |
#248 in Value formatting
103 downloads per month
Used in 19 crates
(4 directly)
12KB
263 lines
A human-readable ID which is safe to use as a component in a URI path.
and supports constant Labels.
Features:
hash: enable support forasync-hashserde: enable support forserdestream: enable support fordestreamuuid: enable support foruuid
Example:
use hr_id::{label, Id, Label};
const HELLO: Label = label("hello"); // unchecked!
let world: Id = "world".parse().expect("id");
assert_eq!(format!("{}, {}!", HELLO, world), "hello, world!");
assert_eq!(Id::from(HELLO), "hello");
assert!(Id::from_str("this string has whitespace").is_err());
hr-id
A human-readable unique ID for Rust which:
- supports Unicode
- disallows whitespace
- disallows common control characters
..and each of/~$`&|=^{}<>'\?:@#() - disallows ASCII control characters (bytes with integer value < 32)
- can be used to represent a domain name or URI segment but not an entire URL
- implements
From<Uuid> - implements
SerializeandDeserializewith theserdefeature - implements
ToStreamandFromStreamwith thedestreamfeature
Dependencies
~0.3–1.2MB
~24K SLoC