Debian Codegraph @

/

debian rust-ulid 1.2.1-4debian librust-ulid-dev debian librust-ulid-1+default-dev debian librust-ulid-1+postgres-dev debian librust-ulid-1+std-dev debian librust-ulid-1+rkyv-dev debian librust-ulid-1-dev debian librust-ulid-1.2-dev debian librust-ulid-1.2.1-dev debian ulid-cli cargo ulid-cli 0.3.1cargo ulid 1.2.1 debianinimakefilemarkdownrustrustrust-c-abishelltomlyaml 33 files · 291 symbols
View dependency graph

Depends on

  • cmark-gfm (cmark-gfm)
  • dh-rust (dh-sequence-rust)
  • rust-bytes (librust-bytes-1+default-dev)
  • rust-postgres-types (librust-postgres-types-0.2+default-dev)
  • rust-serde-derive (librust-serde-derive-1+default-dev)
  • rust-structopt (librust-structopt-0.3+default-dev)
  • debhelper-compat, librust-rand+default-dev, librust-rkyv-0.8+default-dev, librust-serde-1+default-dev, librust-time-0.3+default-dev, librust-uuid-1+default-dev, libstd-rust-dev
README (full)

ulid-rs

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

Quickstart

use ulid::Ulid;

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

// 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());

Crate Features

  • std (default): Flag to toggle use of std and rand. Disable this flag for #[no_std] support.
  • serde: Enables serialization and deserialization of Ulid types via serde. ULIDs are serialized using their canonical 26-character representation as defined in the ULID standard. An optional ulid_as_u128 module is provided, which enables serialization through an Ulid's inner u128 primitive type. See the documentation and serde docs for more information.
  • uuid: Implements infallible conversions between ULIDs and UUIDs from the uuid crate via the std::convert::From trait.

Benchmark

Benchmarks were run on my desktop (Win 10/WSL2 Ubuntu; Ryzen 7 5950x). Run them yourself with cargo bench.

test bench_from_string        ... bench:          13 ns/iter (+/- 0)
test bench_from_time          ... bench:          13 ns/iter (+/- 0)
test bench_generator_generate ... bench:          29 ns/iter (+/- 0)
test bench_new                ... bench:          31 ns/iter (+/- 1)
test bench_to_str             ... bench:           7 ns/iter (+/- 0)
test bench_to_string          ... bench:          19 ns/iter (+/- 0)
dir .github/
dir benches/
dir cli/
dir debian/
dir src/
dir tests/
file .gitignore
file Cargo.toml
file LICENSE
file README.md