yulid

Crates.ioyulid
lib.rsyulid
version0.1.0
sourcesrc
created_at2018-12-28 20:19:52.466063
updated_at2018-12-28 20:19:52.466063
descriptionA library to generate and parse ULIDs.
homepagehttps://github.com/jkcclemens/yulid
repositoryhttps://github.com/jkcclemens/yulid
max_upload_size
id104250
size30,268
Anna (anna-is-cute)

documentation

https://docs.rs/yulid

README

yulid

A Rust implementation of the ULID spec that aims to be as similar to uuid as possible.

Supports

  • Generation with rand API (by default)
  • Serialisation and deserialisation with serde (with feature)
  • Converting to and from UUIDs provided by the uuid crate (with feature)

Examples

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();
}
Commit count: 8

cargo fmt