Crates.io | yulid |
lib.rs | yulid |
version | 0.1.0 |
source | src |
created_at | 2018-12-28 20:19:52.466063 |
updated_at | 2018-12-28 20:19:52.466063 |
description | A library to generate and parse ULIDs. |
homepage | https://github.com/jkcclemens/yulid |
repository | https://github.com/jkcclemens/yulid |
max_upload_size | |
id | 104250 |
size | 30,268 |
A Rust implementation of the ULID spec that aims to be as similar to
uuid
as possible.
rand
API (by default)serde
(with feature)uuid
crate (with feature)use yulid::Ulid;
fn main() {
// create a new ULID
let ulid = Ulid::new();
// print the lowercase form
println!("{}", ulid.to_lowercase());
// get the DateTime<Utc> this ULID contains
let timestamp = ulid.timestamp();
}
use rand::{Rng, thread_rng};
use yulid::Ulid;
fn main() {
// generate a ULID using rand
let ulid: Ulid = thread_rng().gen();
}