Trait GenerateRandom

Source
pub trait GenerateRandom {
    // Required method
    fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self;
}
Expand description

Enable randomly generating values of a type.

This trait can be implemented using the derive macro of the same name: GenerateRandom.

Required Methods§

Source

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Create a new random value of this type.

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.

Implementations on Foreign Types§

Source§

impl GenerateRandom for bool

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for char

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for f32

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for f64

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for i8

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for i16

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for i32

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for i64

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for i128

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for isize

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for u8

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for u16

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for u32

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for u64

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for u128

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl GenerateRandom for ()

Source§

fn generate_random<R: Rng + ?Sized>(_rng: &mut R) -> Self

Source§

impl GenerateRandom for usize

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> GenerateRandom for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<B, C, D, E, F, G, H, I, J, K, L> GenerateRandom for (B, C, D, E, F, G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<C, D, E, F, G, H, I, J, K, L> GenerateRandom for (C, D, E, F, G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<D, E, F, G, H, I, J, K, L> GenerateRandom for (D, E, F, G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<E, F, G, H, I, J, K, L> GenerateRandom for (E, F, G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<F, G, H, I, J, K, L> GenerateRandom for (F, G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<G, H, I, J, K, L> GenerateRandom for (G, H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<H, I, J, K, L> GenerateRandom for (H, I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<I, J, K, L> GenerateRandom for (I, J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<J, K, L> GenerateRandom for (J, K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<K, L> GenerateRandom for (K, L)

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<L> GenerateRandom for (L,)
where L: GenerateRandom,

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Source§

impl<T: GenerateRandom> GenerateRandom for Option<T>

Source§

fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self

Implementors§