rusty_ulid 0.2.1

Rust ULID (Universally Unique Lexicographically Sortable Identifier) generation and processing
Documentation

rusty_ulid

Build Status codecov Crates.io docs.rs dependency status

This is a Rust implementation of the ULID Universally Unique Lexicographically Sortable Identifiers.

Take a look at the changelog for a detailed list of all changes.

Quickstart

extern crate rusty_ulid;
use rusty_ulid::new_ulid_string;
use rusty_ulid::new_ulid_bytes;

// Generate a ULID string
let ulid_string: String = new_ulid_string();
assert_eq!(ulid_string.len(), 26);

// Generate ULID bytes
let ulid_bytes: [u8; 16] = new_ulid_bytes();
assert_eq!(ulid_bytes.len(), 16);
extern crate rusty_ulid;
use rusty_ulid::Ulid;

// Generate a ULID
let ulid = Ulid::new();

// Generate a string for a ULID
let ulid_string = ulid.to_string();

// Create ULID from a string
let result = Ulid::from_str(&ulid_string);

assert_eq!(Ok(ulid), result);

Benchmark

Run the benchmarks by executing cargo bench.