Add a convenience next(range) to Rng.
This commit is contained in:
@ -4,6 +4,7 @@ use core::future::Future;
|
||||
pub trait Rng {
|
||||
type Error;
|
||||
|
||||
#[rustfmt::skip]
|
||||
type RngFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
@ -14,4 +15,11 @@ pub trait Rng {
|
||||
/// filling the buffer. Upon completion, the buffer will be completely
|
||||
/// filled or an error will have been reported.
|
||||
fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a>;
|
||||
|
||||
#[rustfmt::skip]
|
||||
type NextFuture<'a>: Future<Output = Result<u32, Self::Error>> + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
fn next<'a>(&'a mut self, range: u32) -> Self::NextFuture<'a>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user