random_constructible

Trait RandomConstructible

Source
pub trait RandomConstructible:
    Default
    + Eq
    + Hash
    + Sized
    + Copy {
    // Required methods
    fn all_variants() -> Vec<Self>;
    fn default_weight(&self) -> f64;
    fn default_probability_provider(    ) -> Arc<dyn RandomConstructibleProbabilityMapProvider<Self>>;

    // Provided methods
    fn random_with_probabilities(
        provider: &dyn RandomConstructibleProbabilityMapProvider<Self>,
    ) -> Self { ... }
    fn random() -> Self { ... }
    fn random_with_rng<RNG: Rng + ?Sized>(rng: &mut RNG) -> Self { ... }
    fn uniform() -> Self { ... }
    fn sample_from_provider<RNG: Rng + ?Sized>(
        provider: &dyn RandomConstructibleProbabilityMapProvider<Self>,
        rng: &mut RNG,
    ) -> Self { ... }
}

Required Methods§

Provided Methods§

Source

fn random_with_probabilities( provider: &dyn RandomConstructibleProbabilityMapProvider<Self>, ) -> Self

Source

fn random() -> Self

Source

fn random_with_rng<RNG: Rng + ?Sized>(rng: &mut RNG) -> Self

Source

fn uniform() -> Self

Source

fn sample_from_provider<RNG: Rng + ?Sized>( provider: &dyn RandomConstructibleProbabilityMapProvider<Self>, rng: &mut RNG, ) -> Self

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§