Crates.io | tempoid |
lib.rs | tempoid |
version | 0.1.1 |
source | src |
created_at | 2024-09-23 10:45:46.43552 |
updated_at | 2024-09-25 07:57:38.726838 |
description | Generates URL-friendly, unique, and short IDs that are sortable by time. Inspired by nanoid and UUIDv7. |
homepage | https://tempoid.dev |
repository | https://github.com/temporal-id/tempoid-rust |
max_upload_size | |
id | 1383885 |
size | 23,754 |
Short IDs with temporal ordering.
A library to generate URL-friendly, unique, and short IDs that are sortable by time. Inspired by nanoid and UUIDv7.
See tempoid.dev for more information.
Example ID:
0uoVxkjTFsrRX30O5B9fX
<------><----------->
Time Random
The 13 random characters exceed the randomness of UUIDv7 (≈10^23 vs ≈10^22).
# Cargo.toml
[dependencies]
tempoid = <version>
use tempoid::{TempoId, alphabet};
fn main() {
// generate a new ID
let id = TempoId::generate();
// parse an ID
let id = TempoId::parse("0uoVxkjTFsrRX30O5B9fX");
// convert an ID to a string
let id = TempoId::generate();
let string = id.to_string();
// use a different alphabet
let id = TempoId::generate_with_alphabet(alphabet::base64);
// use a custom alphabet
let id = TempoId::generate_with_alphabet("ABCDEF");
}
Licensed under either of Apache License, Version 2.0 or MIT license at your option.