pub struct Jitter(/* private fields */);Expand description
How much of a back-off’s random range to add, as a fraction of u32::MAX.
Integer rather than floating point, so the schedule a test asserts is the schedule that
runs: Jitter::from_ratio(1, 2) is exactly half the range on every platform, which
0.5f64 multiplied into a duration is not.
Implementations§
Source§impl Jitter
impl Jitter
Sourcepub const fn from_random_u32(value: u32) -> Self
pub const fn from_random_u32(value: u32) -> Self
A uniformly drawn u32 — four bytes straight from an entropy source — as a jitter.
Sourcepub const fn from_ratio(numerator: u32, denominator: u32) -> Self
pub const fn from_ratio(numerator: u32, denominator: u32) -> Self
Trait Implementations§
impl Copy for Jitter
impl Eq for Jitter
Source§impl Ord for Jitter
impl Ord for Jitter
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Jitter
impl PartialOrd for Jitter
impl StructuralPartialEq for Jitter
Auto Trait Implementations§
impl Forget for Jitter
impl Freeze for Jitter
impl Move for Jitter
impl RefUnwindSafe for Jitter
impl Send for Jitter
impl Sync for Jitter
impl Unpin for Jitter
impl UnsafeUnpin for Jitter
impl UnwindSafe for Jitter
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