pub struct Delay(/* private fields */);
Expand description
Unitless delay. Can be converted to a Duration
with to_duration
.
Implementations§
Source§impl Delay
impl Delay
Sourcepub fn exp(seed: &[u8; 16]) -> Self
pub fn exp(seed: &[u8; 16]) -> Self
Returns a random delay sampled from an exponential distribution with mean 1. seed
provides the entropy.
Sourcepub fn to_duration(self, unit: Duration) -> Duration
pub fn to_duration(self, unit: Duration) -> Duration
Convert the unitless delay into a Duration
by multiplying by unit
. For delays
calculated by different parties to match, they must all agree on unit
!
Trait Implementations§
Source§impl AddAssign for Delay
impl AddAssign for Delay
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moreSource§impl Ord for Delay
impl Ord for Delay
Source§impl PartialOrd for Delay
impl PartialOrd for Delay
impl Copy for Delay
impl Eq for Delay
impl StructuralPartialEq for Delay
Auto Trait Implementations§
impl Freeze for Delay
impl RefUnwindSafe for Delay
impl Send for Delay
impl Sync for Delay
impl Unpin for Delay
impl UnwindSafe for Delay
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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