pub trait Client {
    fn randomness_available(
        randomness: &mut dyn Iterator<Item = u32>,
        error: Result<(), ErrorCode>
    ) -> Continue; }
Expand description

An Rng client

Clients of an Rng must implement this trait.

Required Methods

Called by the (RNG)[trait.RNG.html] when there are one or more random numbers available

randomness in an Iterator of available random numbers. The amount of randomness available may increase if randomness is not consumed quickly so clients should not rely on iterator termination to finish consuming random numbers.

The client returns either Continue::More if the iterator did not have enough random values and the client would like to be called again when more is available, or Continue::Done.

If randoness_available is triggered after a call to cancel() then error MUST be CANCEL and randomness MAY contain random bits.