pub struct Context { /* private fields */ }
Expand description
A thread-safe, stateful context for the v1 generator to help ensure process-wide uniqueness.
Implementations
sourceimpl Context
impl Context
sourcepub const fn new(count: u16) -> Self
pub const fn new(count: u16) -> Self
Creates a thread-safe, internally mutable context to help ensure uniqueness.
This is a context which can be shared across threads. It maintains an internal counter that is incremented at every request, the value ends up in the clock_seq portion of the UUID (the fourth group). This will improve the probability that the UUID is unique across the process.
sourcepub fn new_random() -> Self
pub fn new_random() -> Self
Creates a thread-safe, internally mutable context that’s seeded with a random value.
This method requires either the rng
or fast-rng
feature to also be
enabled.
This is a context which can be shared across threads. It maintains an internal counter that is incremented at every request, the value ends up in the clock_seq portion of the UUID (the fourth group). This will improve the probability that the UUID is unique across the process.
Trait Implementations
sourceimpl ClockSequence for Context
impl ClockSequence for Context
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more