Struct druid_shell::Counter
source · pub struct Counter(_);Expand description
An incrementing counter for generating unique ids.
This can be used safely from multiple threads.
The counter will overflow if next() is called 2^64 - 2 times.
If this is possible for your application, and reuse would be undesirable,
use something else.
Implementations§
source§impl Counter
impl Counter
sourcepub const unsafe fn new_unchecked(init: u64) -> Counter
pub const unsafe fn new_unchecked(init: u64) -> Counter
sourcepub fn next_nonzero(&self) -> NonZeroU64
pub fn next_nonzero(&self) -> NonZeroU64
Return the next value, as a NonZeroU64.
Auto Trait Implementations§
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnwindSafe for Counter
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.