2021-04-26 15:43:19 +02:00
|
|
|
use core::future::Future;
|
|
|
|
|
|
|
|
/// Random-number Generator
|
|
|
|
pub trait Rng {
|
|
|
|
type Error;
|
|
|
|
|
|
|
|
type RngFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
|
|
|
where
|
|
|
|
Self: 'a;
|
|
|
|
|
|
|
|
/// Completely fill the provided buffer with random bytes.
|
|
|
|
///
|
|
|
|
/// May result in delays if entropy is exhausted prior to completely
|
|
|
|
/// filling the buffer. Upon completion, the buffer will be completely
|
|
|
|
/// filled or an error will have been reported.
|
2021-05-06 20:33:29 +02:00
|
|
|
fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a>;
|
2021-04-26 15:43:19 +02:00
|
|
|
}
|