MCPcopy Index your code
hub / github.com/dylanhart/ulid-rs

github.com/dylanhart/ulid-rs @v1.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.1 ↗ · + Follow
91 symbols 167 edges 12 files 24 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ulid-rs

Build Status Crates.io docs.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)

Core symbols most depended-on inside this repo

now
called by 10
src/time_utils.rs
to_string
called by 8
src/lib.rs
increment
called by 4
src/lib.rs
encode
called by 4
src/base32.rs
now
called by 4
tests/wasm32-datetime.rs
generate_from_datetime
called by 3
src/generator.rs
serialize
called by 2
src/serde.rs
timestamp_ms
called by 2
src/lib.rs

Shape

Function 49
Method 35
Class 4
Enum 3

Languages

Rust100%

Modules by API surface

src/lib.rs25 symbols
src/time.rs13 symbols
src/generator.rs12 symbols
src/base32.rs11 symbols
tests/wasm32-datetime.rs8 symbols
benches/bench.rs6 symbols
src/serde.rs4 symbols
cli/src/bin/ulid.rs4 symbols
src/uuid.rs3 symbols
src/postgres.rs3 symbols
src/time_utils.rs1 symbols
src/rkyv.rs1 symbols

For agents

$ claude mcp add ulid-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact