Struct rand_functors::Counter
source · pub struct Counter<S: BuildHasher + Default = RandomState> { /* private fields */ }Expand description
Produces all possible outputs of the random process, with repetition, stored
in a HashMap.
Counter is optimal in scenarios where certain operations will map many
inputs to the same output. Examples include conditionally zeroing out a
field of a struct or the use of functions like saturating_add or
saturating_mul.
Trait Implementations§
source§impl<S: PartialEq + BuildHasher + Default> PartialEq for Counter<S>
impl<S: PartialEq + BuildHasher + Default> PartialEq for Counter<S>
source§impl<S: BuildHasher + Default> RandomStrategy for Counter<S>
impl<S: BuildHasher + Default> RandomStrategy for Counter<S>
source§fn fmap<A: Inner, B: Inner, F: Fn(A) -> B>(
f: Self::Functor<A>,
func: F
) -> Self::Functor<B>
fn fmap<A: Inner, B: Inner, F: Fn(A) -> B>( f: Self::Functor<A>, func: F ) -> Self::Functor<B>
Applies the given function to the functor’s inner.
source§fn fmap_flat<A: Inner, B: Inner, F: FnMut(A) -> Self::Functor<B>>(
f: Self::Functor<A>,
_: &mut impl Rng,
func: F
) -> Self::Functor<B>
fn fmap_flat<A: Inner, B: Inner, F: FnMut(A) -> Self::Functor<B>>( f: Self::Functor<A>, _: &mut impl Rng, func: F ) -> Self::Functor<B>
Applies the given function to the functor’s inner, flattening one layer
of nested structure.
source§fn fmap_rand<A: Inner, B: Inner, R: RandomVariable, F: Fn(A, R) -> B>(
f: Self::Functor<A>,
_: &mut impl Rng,
func: F
) -> Self::Functor<B>where
Standard: Distribution<R>,
fn fmap_rand<A: Inner, B: Inner, R: RandomVariable, F: Fn(A, R) -> B>(
f: Self::Functor<A>,
_: &mut impl Rng,
func: F
) -> Self::Functor<B>where
Standard: Distribution<R>,
Using the strategy specified by the implementor, applies the given
binary function to the given functor and an element of the sample space
of a
RandomVariable. Read moresource§fn fmap_rand_range<A: Inner, B: Inner, R: RandomVariable + SampleUniform, F: Fn(A, R) -> B>(
f: Self::Functor<A>,
range: impl RandomVariableRange<R>,
_: &mut impl Rng,
func: F
) -> Self::Functor<B>where
Standard: Distribution<R>,
fn fmap_rand_range<A: Inner, B: Inner, R: RandomVariable + SampleUniform, F: Fn(A, R) -> B>(
f: Self::Functor<A>,
range: impl RandomVariableRange<R>,
_: &mut impl Rng,
func: F
) -> Self::Functor<B>where
Standard: Distribution<R>,
Using the strategy specified by the implementor, applies the given
binary function to the given functor and an element of the sample space
of a
RandomVariableRange. Read moreimpl<S: Copy + BuildHasher + Default> Copy for Counter<S>
impl<S: Eq + BuildHasher + Default> Eq for Counter<S>
impl<S: BuildHasher + Default> StructuralPartialEq for Counter<S>
Auto Trait Implementations§
impl<S> Freeze for Counter<S>
impl<S> RefUnwindSafe for Counter<S>where
S: RefUnwindSafe,
impl<S> Send for Counter<S>where
S: Send,
impl<S> Sync for Counter<S>where
S: Sync,
impl<S> Unpin for Counter<S>where
S: Unpin,
impl<S> UnwindSafe for Counter<S>where
S: 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