pub struct UniformDelayPerPacket<Rng = StdRng>where
Rng: RngCore,{
pub upper_bound: Delay,
pub lower_bound: Delay,
pub seed: u64,
pub count: usize,
/* private fields */
}Expand description
The model of a per-packet delay trace subjects to a uniform distribution.
The delay will subject to a uniform distribution in [lower_bound, upper_bound]
If the count is 0, the delay will be repeated forever, else it will be repeated count times.
§Examples
Default values for lower_bound and upper_bound are 0ms and 10ms, respectively.
let mut uniform_delay = UniformDelayPerPacketConfig::new()
.upper_bound(Delay::from_micros(12100))
.lower_bound(Delay::from_micros(11900))
.count(2)
.seed(42)
.build();
assert_eq!(uniform_delay.next_delay(), Some(Delay::from_nanos(12005311)));
assert_eq!(uniform_delay.next_delay(), Some(Delay::from_nanos(12008545)));
assert_eq!(uniform_delay.next_delay(), None);Fields§
§upper_bound: Delay§lower_bound: Delay§seed: u64§count: usizeTrait Implementations§
Source§impl<Rng> Clone for UniformDelayPerPacket<Rng>
impl<Rng> Clone for UniformDelayPerPacket<Rng>
Source§fn clone(&self) -> UniformDelayPerPacket<Rng>
fn clone(&self) -> UniformDelayPerPacket<Rng>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Rng> Debug for UniformDelayPerPacket<Rng>
impl<Rng> Debug for UniformDelayPerPacket<Rng>
Source§impl<Rng: RngCore + Send> DelayPerPacketTrace for UniformDelayPerPacket<Rng>
impl<Rng: RngCore + Send> DelayPerPacketTrace for UniformDelayPerPacket<Rng>
fn next_delay(&mut self) -> Option<Delay>
Source§impl<Rng> PartialEq for UniformDelayPerPacket<Rng>
impl<Rng> PartialEq for UniformDelayPerPacket<Rng>
impl<Rng> Copy for UniformDelayPerPacket<Rng>
impl<Rng> StructuralPartialEq for UniformDelayPerPacket<Rng>where
Rng: RngCore,
Auto Trait Implementations§
impl<Rng> Freeze for UniformDelayPerPacket<Rng>where
Rng: Freeze,
impl<Rng> RefUnwindSafe for UniformDelayPerPacket<Rng>where
Rng: RefUnwindSafe,
impl<Rng> Send for UniformDelayPerPacket<Rng>where
Rng: Send,
impl<Rng> Sync for UniformDelayPerPacket<Rng>where
Rng: Sync,
impl<Rng> Unpin for UniformDelayPerPacket<Rng>where
Rng: Unpin,
impl<Rng> UnsafeUnpin for UniformDelayPerPacket<Rng>where
Rng: UnsafeUnpin,
impl<Rng> UnwindSafe for UniformDelayPerPacket<Rng>where
Rng: 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> 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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.