#url #unique-ids #unicode #url-safe #hash #serde #human-readable-unique

hr-id

A human-readable unique ID which supports Unicode, safe for URLs and file paths

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

Download history 13/week @ 2026-02-19 3/week @ 2026-02-26 4/week @ 2026-03-05 15/week @ 2026-03-12 23/week @ 2026-03-19 11/week @ 2026-04-02 82/week @ 2026-04-09 22/week @ 2026-04-16 19/week @ 2026-04-23 19/week @ 2026-04-30 52/week @ 2026-05-14 10/week @ 2026-05-21 41/week @ 2026-06-04

103 downloads per month
Used in 19 crates (4 directly)

Apache-2.0

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 for async-hash
  • serde: enable support for serde
  • stream: enable support for destream
  • uuid: enable support for uuid

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 Serialize and Deserialize with the serde feature
  • implements ToStream and FromStream with the destream feature

Dependencies

~0.3–1.2MB
~24K SLoC