pub struct ChainSampler<S1, F>{ /* private fields */ }Expand description
A sampler that chains two sub-samplers together, combining their results using a closure.
Implementations§
Source§impl<S1, F> ChainSampler<S1, F>
impl<S1, F> ChainSampler<S1, F>
Sourcepub fn new(sampler_1: S1, sampler_2: Box<dyn DurationSampler>, f: F) -> Self
pub fn new(sampler_1: S1, sampler_2: Box<dyn DurationSampler>, f: F) -> Self
Creates a new ChainSampler.
Trait Implementations§
Source§impl<S1, F> DurationSampler for ChainSampler<S1, F>
impl<S1, F> DurationSampler for ChainSampler<S1, F>
Auto Trait Implementations§
impl<S1, F> Freeze for ChainSampler<S1, F>
impl<S1, F> !RefUnwindSafe for ChainSampler<S1, F>
impl<S1, F> !Send for ChainSampler<S1, F>
impl<S1, F> !Sync for ChainSampler<S1, F>
impl<S1, F> Unpin for ChainSampler<S1, F>
impl<S1, F> UnsafeUnpin for ChainSampler<S1, F>where
S1: UnsafeUnpin,
F: UnsafeUnpin,
impl<S1, F> !UnwindSafe for ChainSampler<S1, F>
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> 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