pub struct ThreadLocalContext<C>(/* private fields */)
where
C: 'static;
Expand description
A wrapper for a context that uses thread-local storage.
Implementations§
source§impl<C> ThreadLocalContext<C>where
C: 'static,
impl<C> ThreadLocalContext<C>where
C: 'static,
sourcepub const fn new(local_key: &'static LocalKey<C>) -> ThreadLocalContext<C>
pub const fn new(local_key: &'static LocalKey<C>) -> ThreadLocalContext<C>
Wrap a thread-local container with a context.
Trait Implementations§
source§impl<C> ClockSequence for ThreadLocalContext<C>where
C: ClockSequence + 'static,
impl<C> ClockSequence for ThreadLocalContext<C>where
C: ClockSequence + 'static,
source§type Output = <C as ClockSequence>::Output
type Output = <C as ClockSequence>::Output
The type of sequence returned by this counter.
source§fn generate_sequence(
&self,
seconds: u64,
subsec_nanos: u32,
) -> <ThreadLocalContext<C> as ClockSequence>::Output
fn generate_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> <ThreadLocalContext<C> as ClockSequence>::Output
Get the next value in the sequence to feed into a timestamp. Read more
source§fn generate_timestamp_sequence(
&self,
seconds: u64,
subsec_nanos: u32,
) -> (<ThreadLocalContext<C> as ClockSequence>::Output, u64, u32)
fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (<ThreadLocalContext<C> as ClockSequence>::Output, u64, u32)
Get the next value in the sequence, potentially also adjusting the timestamp. Read more
source§fn usable_bits(&self) -> usize
fn usable_bits(&self) -> usize
The number of usable bits from the least significant bit in the result of
ClockSequence::generate_sequence
or ClockSequence::generate_timestamp_sequence
. Read moreAuto Trait Implementations§
impl<C> Freeze for ThreadLocalContext<C>
impl<C> RefUnwindSafe for ThreadLocalContext<C>
impl<C> Send for ThreadLocalContext<C>
impl<C> Sync for ThreadLocalContext<C>
impl<C> Unpin for ThreadLocalContext<C>
impl<C> UnwindSafe for ThreadLocalContext<C>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more