Skip to main content

UuidV7Generator

Struct UuidV7Generator 

Source
pub struct UuidV7Generator { /* private fields */ }
Expand description

Lock-free monotonic RFC 9562 UUIDv7 generator (48-bit ts | ver=7 | 12-bit seq | var=10 | 62-bit rnd).

Implementations§

Source§

impl UuidV7Generator

Lock-free monotonic RFC 9562 UUIDv7 generation methods.

Source

pub fn new() -> Self

Creates a new UuidV7Generator seeded from wall-clock time and stack address.

§Returns
  • Self - Ready lock-free UUIDv7 generator.
Source

pub fn with_seed(seed: u64) -> Self

Creates a UuidV7Generator with an explicit initial 64-bit entropy seed.

§Arguments
  • u64 - Initial entropy seed.
§Returns
  • Self - Ready UUIDv7 generator.
Source

pub fn next_uuid(&self) -> UuidV7

Generates the next strictly monotonic RFC 9562 UuidV7 using wall-clock time.

§Returns
  • UuidV7 - A unique, time-ordered UUIDv7.
Source

pub fn next_uuid_at(&self, now_unix_ms: u64) -> UuidV7

Generates the next strictly monotonic RFC 9562 UuidV7 at an explicit Unix timestamp.

§Arguments
  • u64 - Unix timestamp in milliseconds.
§Returns
  • UuidV7 - A unique, time-ordered UUIDv7.

Trait Implementations§

Source§

impl Debug for UuidV7Generator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for UuidV7Generator

Default construction for UuidV7Generator.

Source§

fn default() -> Self

Creates a new UuidV7Generator seeded from wall-clock entropy.

§Returns
  • Self - Ready UUIDv7 generator.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.