Crate timeflake

Source
Expand description

Rust port of Timeflake, a 128-bit, roughly-ordered, URL-safe UUID.

§Usage

[dependencies]
timeflake = "0.1.0"
use timeflake::Timeflake;

fn main() {
    let mut rng = rand::rng();
    let flake = Timeflake::new_random(&mut rng);
    println!("{flake}");
}

Modules§

error

Structs§

Timeflake
Represents a Timeflake, a unique identifier combining timestamp and random data.

Constants§

BASE62
The Base62 character set used for encoding and decoding Timeflakes.
HEX
The hexadecimal character set used for encoding Timeflakes as hexadecimal strings.
MAX_RANDOM
The maximum possible random component in a Timeflake.
MAX_TIMEFLAKE
The maximum possible integer value of a Timeflake.
MAX_TIMESTAMP
The maximum possible timestamp component in a Timeflake.

Functions§

max_random_biguint
Reinterpret the MAX_RANDOM as a BigUint
max_timeflake_biguint
Reinterpret the MAX_TIMEFLAKE as a BigUint