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 PartialEq for Delay
impl PartialEq for Delay
source§impl PartialOrd for Delay
impl PartialOrd for Delay
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl 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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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