CanSample

Trait CanSample 

Source
pub trait CanSample<T> {
    // Required method
    fn sample(&mut self) -> T;

    // Provided methods
    fn sample_array<const N: usize>(&mut self) -> [T; N] { ... }
    fn sample_vec(&mut self, n: usize) -> Vec<T> { ... }
}
Expand description

A trait for sampling challenge elements from the Fiat-Shamir transcript.

Sampling produces pseudo-random elements deterministically derived from the absorbed inputs and the sponge state.

Required Methods§

Source

fn sample(&mut self) -> T

Sample a single challenge value from the transcript.

Provided Methods§

Source

fn sample_array<const N: usize>(&mut self) -> [T; N]

Sample an array of N challenge values from the transcript.

Source

fn sample_vec(&mut self, n: usize) -> Vec<T>

Sample a Vec of n challenge values from the transcript.

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<C, T> CanSample<T> for &mut C
where C: CanSample<T>,

Source§

fn sample(&mut self) -> T

Source§

fn sample_array<const N: usize>(&mut self) -> [T; N]

Source§

fn sample_vec(&mut self, n: usize) -> Vec<T>

Implementors§

Source§

impl<F, EF, Inner> CanSample<EF> for SerializingChallenger32<F, Inner>
where F: PrimeField32, EF: BasedVectorSpace<F>, Inner: CanSample<u8>,

Source§

impl<F, EF, Inner> CanSample<EF> for SerializingChallenger64<F, Inner>
where F: PrimeField64, EF: BasedVectorSpace<F>, Inner: CanSample<u8>,

Source§

impl<F, EF, P, const WIDTH: usize, const RATE: usize> CanSample<EF> for DuplexChallenger<F, P, WIDTH, RATE>

Source§

impl<F, EF, PF, P, const WIDTH: usize, const RATE: usize> CanSample<EF> for MultiField32Challenger<F, PF, P, WIDTH, RATE>

Source§

impl<T, H, const OUT_LEN: usize> CanSample<T> for HashChallenger<T, H, OUT_LEN>