1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
//! Random Number Generator Interface

use nb;

/// Nonblocking stream of random bytes.
pub trait Read {
    /// An enumeration of RNG errors.
    ///
    /// For infallible implementations, will be `Infallible`
    type Error;

    /// Get a number of bytes from the RNG.
    fn try_read(&mut self, buf: &mut [u8]) -> nb::Result<usize, Self::Error>;
}