Trait UlidGenerator

Source
pub trait UlidGenerator<ID, T, R>
where ID: Ulid, T: TimeSource<ID::Ty>, R: RandSource<ID::Ty>,
{ // Required methods fn new(clock: T, rng: R) -> Self; fn next_id(&self) -> IdGenStatus<ID>; fn try_next_id(&self) -> Result<IdGenStatus<ID>>; }
Expand description

A minimal interface for generating Ulid IDs

Required Methods§

Source

fn new(clock: T, rng: R) -> Self

Source

fn next_id(&self) -> IdGenStatus<ID>

Returns the next available ID

Source

fn try_next_id(&self) -> Result<IdGenStatus<ID>>

A fallible version of Self::next_id that returns a Result.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<ID, T, R> UlidGenerator<ID, T, R> for BasicUlidGenerator<ID, T, R>
where ID: Ulid, T: TimeSource<ID::Ty>, R: RandSource<ID::Ty>,

Source§

impl<ID, T, R> UlidGenerator<ID, T, R> for LockUlidGenerator<ID, T, R>
where ID: Ulid, T: TimeSource<ID::Ty>, R: RandSource<ID::Ty>,