pub enum ContextCell<C> {
Present(C),
Missing,
}Expand description
A wrapper around context that allows it to be taken and returned without requiring
all interactions to unwrap (as with Option<C>).
Variants§
Implementations§
Trait Implementations§
Source§impl<C> Clock for Cell<C>where
C: Clock,
impl<C> Clock for Cell<C>where
C: Clock,
Source§fn current(&self) -> SystemTime
fn current(&self) -> SystemTime
Returns the current time.
Source§fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + Send + 'static
fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + Send + 'static
Sleep for the given duration.
Source§fn sleep_until(
&self,
deadline: SystemTime,
) -> impl Future<Output = ()> + Send + 'static
fn sleep_until( &self, deadline: SystemTime, ) -> impl Future<Output = ()> + Send + 'static
Sleep until the given deadline.
Source§impl<C> Metrics for Cell<C>where
C: Metrics,
impl<C> Metrics for Cell<C>where
C: Metrics,
Source§fn with_label(&self, label: &str) -> Self
fn with_label(&self, label: &str) -> Self
Create a new instance of
Metrics with the given label appended to the end
of the current Metrics label. Read moreSource§impl<C> Network for Cell<C>where
C: Network,
impl<C> Network for Cell<C>where
C: Network,
Source§impl<C> ReasonablyRealtime for Cell<C>where
C: ReasonablyRealtime,
impl<C> ReasonablyRealtime for Cell<C>where
C: ReasonablyRealtime,
Source§fn reference_point(&self) -> Self::Instant
fn reference_point(&self) -> Self::Instant
Returns a reference point at the start of an operation.
Source§impl<C> RngCore for Cell<C>where
C: RngCore,
impl<C> RngCore for Cell<C>where
C: RngCore,
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest with random data. Read moreSource§impl<C> Spawner for Cell<C>where
C: Spawner,
impl<C> Spawner for Cell<C>where
C: Spawner,
Source§fn instrumented(self) -> Self
fn instrumented(self) -> Self
Return a
Spawner that instruments the next spawned task with the label of the spawning context.Source§fn spawn<F, Fut, T>(self, f: F) -> Handle<T> ⓘ
fn spawn<F, Fut, T>(self, f: F) -> Handle<T> ⓘ
Spawn a task with the current context. Read more
Source§fn stop(
self,
value: i32,
timeout: Option<Duration>,
) -> impl Future<Output = Result<(), Error>> + Send
fn stop( self, value: i32, timeout: Option<Duration>, ) -> impl Future<Output = Result<(), Error>> + Send
Signals the runtime to stop execution and waits for all outstanding tasks
to perform any required cleanup and exit. Read more
Source§fn stopped(&self) -> Signal ⓘ
fn stopped(&self) -> Signal ⓘ
Returns an instance of a signal::Signal that resolves when Spawner::stop is called by
any task. Read more
Source§impl<C> Storage for Cell<C>where
C: Storage,
impl<C> Storage for Cell<C>where
C: Storage,
Source§type Blob = <C as Storage>::Blob
type Blob = <C as Storage>::Blob
The readable/writeable storage buffer that can be opened by this Storage.
Source§fn open(
&self,
partition: &str,
name: &[u8],
) -> impl Future<Output = Result<(Self::Blob, u64), Error>> + Send
fn open( &self, partition: &str, name: &[u8], ) -> impl Future<Output = Result<(Self::Blob, u64), Error>> + Send
Open an existing blob in a given partition or create a new one, returning
the blob and its length. Read more
impl<C> CryptoRng for Cell<C>where
C: CryptoRng,
Auto Trait Implementations§
impl<C> Freeze for Cell<C>where
C: Freeze,
impl<C> RefUnwindSafe for Cell<C>where
C: RefUnwindSafe,
impl<C> Send for Cell<C>where
C: Send,
impl<C> Sync for Cell<C>where
C: Sync,
impl<C> Unpin for Cell<C>where
C: Unpin,
impl<C> UnwindSafe for Cell<C>where
C: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CryptoRngCore for T
impl<T> CryptoRngCore for T
Source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
Upcast to an
RngCore trait object.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen_bool(&mut self, p: f64) -> bool
fn gen_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. I.e. gen_ratio(2, 3) has chance of 2 in 3, or about 67%, of
returning true. If numerator == denominator, then the returned value
is guaranteed to be true. If numerator == 0, then the returned
value is guaranteed to be false. Read more