pub trait RandConstructEnum:
Default
+ Eq
+ Hash
+ Sized
+ Copy {
// Required methods
fn default_weight(&self) -> f64;
fn all_variants() -> Vec<Self>;
fn create_default_probability_map() -> Arc<HashMap<Self, f64>>;
// Provided methods
fn random_variant() -> Self { ... }
fn uniform_variant() -> Self { ... }
fn random_with_env<P: RandConstructProbabilityMapProvider<Self>>() -> Self { ... }
fn random_uniform_with_env<P: RandConstructProbabilityMapProvider<Self>>( ) -> Self { ... }
fn sample_with_probabilities<RNG: Rng + ?Sized>(
rng: &mut RNG,
probs: &HashMap<Self, f64>,
) -> Self { ... }
fn sample_from_provider<P: RandConstructProbabilityMapProvider<Self>, RNG: Rng + ?Sized>(
rng: &mut RNG,
) -> Self { ... }
fn sample_uniformly_from_provider<P: RandConstructProbabilityMapProvider<Self>, RNG: Rng + ?Sized>(
rng: &mut RNG,
) -> Self { ... }
fn random_with_rng<RNG: Rng + ?Sized>(rng: &mut RNG) -> Self { ... }
}Required Methods§
fn default_weight(&self) -> f64
fn all_variants() -> Vec<Self>
fn create_default_probability_map() -> Arc<HashMap<Self, f64>>
Provided Methods§
fn random_variant() -> Self
fn uniform_variant() -> Self
fn random_with_env<P: RandConstructProbabilityMapProvider<Self>>() -> Self
fn random_uniform_with_env<P: RandConstructProbabilityMapProvider<Self>>() -> Self
fn sample_with_probabilities<RNG: Rng + ?Sized>( rng: &mut RNG, probs: &HashMap<Self, f64>, ) -> Self
fn sample_from_provider<P: RandConstructProbabilityMapProvider<Self>, RNG: Rng + ?Sized>( rng: &mut RNG, ) -> Self
fn sample_uniformly_from_provider<P: RandConstructProbabilityMapProvider<Self>, RNG: Rng + ?Sized>( rng: &mut RNG, ) -> Self
fn random_with_rng<RNG: Rng + ?Sized>(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.