9个版本 (5个重大更新)
| 新 0.6.0 | 2024年8月13日 |
|---|---|
| 0.5.1 | 2023年12月20日 |
| 0.5.0 | 2023年11月6日 |
| 0.4.0 | 2023年7月3日 |
| 0.1.0 | 2022年2月25日 |
358 在 文本处理 中
每月下载 339 次
用于 19 个Crates (直接使用4个)
12KB
263 行代码
hr-id
为Rust提供的可读唯一ID
- 支持Unicode
- 不允许空格
- 不允许常见的控制字符
..和以下每个/~$`&|=^{}<>'\?:@#() - 不允许ASCII控制字符(整数值小于32的字节)
- 可用于表示域名或URI段,但不能表示整个URL
- 实现
From<Uuid> - 实现
Serialize和Deserialize,具有serde功能 - 实现
ToStream和FromStream,具有destream功能
lib.rs:
一个可读的ID,可安全用作URI路径的一部分,并支持常量 Label。
功能
hash: 启用对async-hash的支持serde: 启用对serde的支持stream: 启用对destream的支持uuid: 启用对uuid的支持
示例
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());
依赖
~2.6–4.5MB
~82K SLoC