pub trait RandomWith<D: Clone>: Sized {
// Required method
fn random_with(rng: impl CryptoRngCore, data: D) -> Self;
// Provided methods
fn random_n_with<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
size: usize,
data: D,
) -> Container { ... }
fn random_n_with_each<Container: FromIterator<Self>>(
rng: impl CryptoRngCore,
all_data: impl IntoExactSizeIterator<Item = D>,
) -> Container { ... }
}Expand description
A trait for getting a random value for a type alongside some data.
Required Methods§
fn random_with(rng: impl CryptoRngCore, data: D) -> Self
Provided Methods§
fn random_n_with<Container: FromIterator<Self>>( rng: impl CryptoRngCore, size: usize, data: D, ) -> Container
fn random_n_with_each<Container: FromIterator<Self>>( rng: impl CryptoRngCore, all_data: impl IntoExactSizeIterator<Item = D>, ) -> Container
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.