Trait FlattenableRandomStrategy

Source
pub trait FlattenableRandomStrategy: RandomStrategy {
    // Required method
    fn fmap_flat<A: Inner, B: Inner, F: FnMut(A) -> Self::Functor<B>>(
        f: Self::Functor<A>,
        func: F,
    ) -> Self::Functor<B>;
}
Expand description

A RandomStrategy that supports an fmap_flat operation.

This requires a separate trait as, unlike fmap, a call to fmap_flat may require a functor to grow. This poses problems for stateless strategies. PopulationSampler, for instance, requires an Rng implementor to select which samples to discard.

Required Methods§

Source

fn fmap_flat<A: Inner, B: Inner, F: FnMut(A) -> Self::Functor<B>>( f: Self::Functor<A>, func: F, ) -> Self::Functor<B>

Applies the given function to the functor’s inner, flattening one layer of nested structure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§