pub struct ConstantSampler { /* private fields */ }Expand description
A sampler that consistently returns a constant value.
Implementations§
Source§impl ConstantSampler
impl ConstantSampler
Sourcepub fn constant_sample(&self) -> PendingDuration
pub fn constant_sample(&self) -> PendingDuration
A convenience method to retrieve the PendingDuration without needing an RNG or SimTime.
Trait Implementations§
Source§impl Clone for ConstantSampler
impl Clone for ConstantSampler
Source§fn clone(&self) -> ConstantSampler
fn clone(&self) -> ConstantSampler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConstantSampler
impl Debug for ConstantSampler
Source§impl DurationSampler for ConstantSampler
impl DurationSampler for ConstantSampler
Auto Trait Implementations§
impl Freeze for ConstantSampler
impl RefUnwindSafe for ConstantSampler
impl Send for ConstantSampler
impl Sync for ConstantSampler
impl Unpin for ConstantSampler
impl UnsafeUnpin for ConstantSampler
impl UnwindSafe for ConstantSampler
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<S> ClonableDurationSampler for S
impl<S> ClonableDurationSampler for S
fn box_clone(&self) -> Box<dyn ClonableDurationSampler>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CombinatorExt for Twhere
T: DurationSampler + 'static,
impl<T> CombinatorExt for Twhere
T: DurationSampler + 'static,
Source§fn boxed(self) -> Box<dyn DurationSampler>
fn boxed(self) -> Box<dyn DurationSampler>
Boxes the sampler into a
Box<dyn DurationSampler> to erase its concrete type.Source§fn boxed_clonable(self) -> Box<dyn ClonableDurationSampler>
fn boxed_clonable(self) -> Box<dyn ClonableDurationSampler>
Boxes the sampler as a cloneable trait object.
Requires the underlying sampler to be
Clone, Send, and Sync.Source§fn map<F>(self, f: F) -> MapSampler<Self, F>
fn map<F>(self, f: F) -> MapSampler<Self, F>
Transforms the output of this sampler using the provided closure
f.Source§fn delay(self, delay: Box<dyn DurationSampler>) -> DelaySampler<Self>
fn delay(self, delay: Box<dyn DurationSampler>) -> DelaySampler<Self>
Adds a delay to the result of this sampler using another sampler for the duration.
Source§fn jitter(self, jitter: Box<dyn DurationSampler>) -> JitterSampler<Self>
fn jitter(self, jitter: Box<dyn DurationSampler>) -> JitterSampler<Self>
Adds a jitter (noise) to the result of this sampler using another sampler for the variation.
Source§fn chain<F>(
self,
sampler: Box<dyn DurationSampler>,
f: F,
) -> ChainSampler<Self, F>
fn chain<F>( self, sampler: Box<dyn DurationSampler>, f: F, ) -> ChainSampler<Self, F>
Chains this sampler with another, combining their outputs using the provided closure
f.Source§fn aggregate<F>(
self,
others: impl IntoIterator<Item = Box<dyn DurationSampler>>,
f: F,
) -> AggregateSampler<F>
fn aggregate<F>( self, others: impl IntoIterator<Item = Box<dyn DurationSampler>>, f: F, ) -> AggregateSampler<F>
Aggregates the results of this sampler and a collection of others into a single value
using the provided closure
f.Source§fn aggregate_builder(self) -> AggregateBuilder
fn aggregate_builder(self) -> AggregateBuilder
Returns an
AggregateBuilder initialized with this sampler, allowing for
a more flexible construction of aggregate samplers.Source§fn clamp(self, min: f64, max: f64) -> ClampSampler<Self>
fn clamp(self, min: f64, max: f64) -> ClampSampler<Self>
Clamps the output of this sampler within the range
[min, max].Source§fn ensure_non_negative<F>(
self,
limit_try_count: u8,
fallback: F,
) -> EnsureNonNegativeSampler<Self, F>
fn ensure_non_negative<F>( self, limit_try_count: u8, fallback: F, ) -> EnsureNonNegativeSampler<Self, F>
Ensures the sampled duration is non-negative. Read more
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