miden_crypto::rand

Trait Randomizable

source
pub trait Randomizable: Sized {
    const VALUE_SIZE: usize;

    // Required method
    fn from_random_bytes(source: &[u8]) -> Option<Self>;
}
Expand description

Defines how Self can be read from a sequence of random bytes.

Required Associated Constants§

source

const VALUE_SIZE: usize

Size of Self in bytes.

This is used to determine how many bytes should be passed to the from_random_bytes() function.

Required Methods§

source

fn from_random_bytes(source: &[u8]) -> Option<Self>

Returns Self if the set of bytes forms a valid value, otherwise returns None.

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 Randomizable for u8

source§

const VALUE_SIZE: usize = 1usize

source§

fn from_random_bytes(source: &[u8]) -> Option<u8>

source§

impl Randomizable for u16

source§

impl Randomizable for u32

source§

impl Randomizable for u64

source§

impl Randomizable for u128

source§

const VALUE_SIZE: usize = 16usize

source§

fn from_random_bytes(source: &[u8]) -> Option<u128>

source§

impl Randomizable for BaseElement

source§

impl Randomizable for BaseElement

Implementors§

source§

impl Randomizable for RpoDigest

source§

const VALUE_SIZE: usize = 32usize

source§

impl Randomizable for RpxDigest

source§

const VALUE_SIZE: usize = 32usize

source§

impl Randomizable for miden_crypto::Felt

source§

const VALUE_SIZE: usize = 8usize

source§

impl<B> Randomizable for CubeExtension<B>
where B: ExtensibleField<3>,

source§

const VALUE_SIZE: usize = Self::ELEMENT_BYTES

source§

impl<B> Randomizable for QuadExtension<B>
where B: ExtensibleField<2>,

source§

const VALUE_SIZE: usize = Self::ELEMENT_BYTES