pub struct Context { /* private fields */ }
Expand description
Implementation of crate::Spawner
, crate::Clock
,
crate::Network
, and crate::Storage
for the tokio
runtime.
Trait Implementations§
Source§impl Clock for Context
impl Clock for Context
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 ReasonablyRealtime for Context
impl ReasonablyRealtime for Context
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 RngCore for Context
impl RngCore for Context
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 Spawner for Context
impl Spawner for Context
Source§fn spawn<F, T>(&self, label: &str, f: F) -> Handle<T> ⓘ
fn spawn<F, T>(&self, label: &str, f: F) -> Handle<T> ⓘ
Enqueues a task to be executed. Read more
Source§impl Storage<Blob> for Context
impl Storage<Blob> for Context
impl CryptoRng for Context
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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> 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<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