soroban_sdk::prng

Trait Gen

Source
pub trait Gen {
    // Required method
    fn gen(prng: &Prng) -> Self;
}
Expand description

Implemented by types that support being generated by a Prng.

Required Methods§

Source

fn gen(prng: &Prng) -> Self

Generates a value of the implementing type with the Prng.

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 Gen for u64

Source§

fn gen(prng: &Prng) -> Self

Source§

impl<const N: usize> Gen for [u8; N]

Source§

fn gen(prng: &Prng) -> Self

Generates the array with the Prng.

§Panics

If the array is greater than u32::MAX in length.

Implementors§

Source§

impl<const N: usize> Gen for BytesN<N>