Trait rand_functors::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.

Object Safety§

This trait is not object safe.

Implementors§