| Crates.io | lits |
| lib.rs | lits |
| version | 0.3.1 |
| created_at | 2025-08-30 12:29:31.432787+00 |
| updated_at | 2025-09-14 05:21:10.973428+00 |
| description | A proc-macro collection that parses human-readable literals at compile time. |
| homepage | |
| repository | https://github.com/vilicvane/rust-lits |
| max_upload_size | |
| id | 1817571 |
| size | 20,215 |
A proc-macro collection that parses human-readable strings at compile time.
cargo add lits
use lits::*;
assert_eq!(duration!("7 days"), Duration::from_secs(7 * 24 * 60 * 60));
assert_eq!(datetime!("1970-01-01T00:00:00Z"), UNIX_EPOCH);
assert_eq!(bytes!("1 kiB"), 1024);
assert_eq!(bytes!("1 kB"), 1000);
duration!() ≈ humantime::parse_duration()datetime!() ≈ humantime::parse_rfc3339_weak()bytes!() ≈ FromStr::parse::<bytesize::ByteSize>().as_u64()MIT License.