Struct rand_functors::Counter
source · pub struct Counter<S: BuildHasher + Default = RandomState, N: Clone + Default + NumAssign + Unsigned = usize> { /* 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: Clone + BuildHasher + Default, N: Clone + Clone + Default + NumAssign + Unsigned> Clone for Counter<S, N>
impl<S: Clone + BuildHasher + Default, N: Clone + Clone + Default + NumAssign + Unsigned> Clone for Counter<S, N>
source§impl<S: Debug + BuildHasher + Default, N: Debug + Clone + Default + NumAssign + Unsigned> Debug for Counter<S, N>
impl<S: Debug + BuildHasher + Default, N: Debug + Clone + Default + NumAssign + Unsigned> Debug for Counter<S, N>
source§impl<S: Default + BuildHasher + Default, N: Default + Clone + Default + NumAssign + Unsigned> Default for Counter<S, N>
impl<S: Default + BuildHasher + Default, N: Default + Clone + Default + NumAssign + Unsigned> Default for Counter<S, N>
source§impl<S: BuildHasher + Default, N: Clone + Default + NumAssign + Unsigned> FlattenableRandomStrategy for Counter<S, N>
impl<S: BuildHasher + Default, N: Clone + Default + NumAssign + Unsigned> FlattenableRandomStrategy for Counter<S, N>
source§impl<S: Hash + BuildHasher + Default, N: Hash + Clone + Default + NumAssign + Unsigned> Hash for Counter<S, N>
impl<S: Hash + BuildHasher + Default, N: Hash + Clone + Default + NumAssign + Unsigned> Hash for Counter<S, N>
source§impl<S: PartialEq + BuildHasher + Default, N: PartialEq + Clone + Default + NumAssign + Unsigned> PartialEq for Counter<S, N>
impl<S: PartialEq + BuildHasher + Default, N: PartialEq + Clone + Default + NumAssign + Unsigned> PartialEq for Counter<S, N>
source§impl<S: BuildHasher + Default, N: Clone + Default + NumAssign + Unsigned> RandomStrategy for Counter<S, N>
impl<S: BuildHasher + Default, N: Clone + Default + NumAssign + Unsigned> RandomStrategy for Counter<S, N>
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_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, N: Copy + Clone + Default + NumAssign + Unsigned> Copy for Counter<S, N>
impl<S: Eq + BuildHasher + Default, N: Eq + Clone + Default + NumAssign + Unsigned> Eq for Counter<S, N>
impl<S: BuildHasher + Default, N: Clone + Default + NumAssign + Unsigned> StructuralPartialEq for Counter<S, N>
Auto Trait Implementations§
impl<S, N> Freeze for Counter<S, N>
impl<S, N> RefUnwindSafe for Counter<S, N>where
N: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, N> Send for Counter<S, N>
impl<S, N> Sync for Counter<S, N>
impl<S, N> Unpin for Counter<S, N>
impl<S, N> UnwindSafe for Counter<S, N>where
N: UnwindSafe,
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