Probabilistic

Derive Macro Probabilistic 

Source
#[derive(Probabilistic)]
{
    // Attributes available to this derive:
    #[rng]
}
Expand description

Procedural macro to automatically implement the Probabilistic trait for a struct.

§Requirements

  • The struct must have a field marked with #[rng] or, if not present, a field named rng that implements CryptoRngCore.

§Behavior

  • Implements the rng(&mut self) method, returning a mutable reference to the selected field.

§Usage

#[derive(Probabilistic)]
pub struct MyParty {
    #[rng]
    my_rng: MyRngType,
    // ...
}
// or, fallback:
#[derive(Probabilistic)]
pub struct MyParty { rng: MyRngType, ... }