Skip to main content

Crate ulid

Crate ulid 

Source
Expand description

§ulid-rs

This is a Rust implementation of the ulid project which provides Universally Unique Lexicographically Sortable Identifiers.

§Quickstart

// Generate a ulid
let ulid = Ulid::generate();

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

// Create from a String
let res = Ulid::from_string(&s);
assert_eq!(ulid, res.unwrap());

// Or using FromStr
let res = s.parse();
assert_eq!(ulid, res.unwrap());

Modules§

serde
Serialization and deserialization.

Structs§

ArchivedUlid
An archived Ulid
Generator
A Ulid generator that provides monotonically increasing Ulids. This is implemented to match the reference generator’s algorithm and it’s issues.
Overflow
Would overflow into the next millisecond
StepRng
Mock Rng implementation that returns a predictable sequence of values.
Ulid
A Ulid is a unique 128-bit lexicographically sortable identifier
UlidResolver
The resolver for an archived Ulid

Enums§

DecodeError
An error that can occur when decoding a base32 string
EncodeError
An error that can occur when encoding a base32 string

Constants§

ULID_LEN
Length of a string-encoded Ulid