Move random utils to another trait.
This commit is contained in:
parent
78f7d1b786
commit
7fa3b27cac
@ -126,7 +126,9 @@ impl<T: Instance> traits::rng::Rng for Random<T> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Instance> traits::rng::Random for Random<T> {
|
||||
#[rustfmt::skip]
|
||||
type NextFuture<'a> where Self: 'a = impl Future<Output=Result<u32, Self::Error>> + 'a;
|
||||
|
||||
|
@ -5,9 +5,9 @@ pub trait Rng {
|
||||
type Error;
|
||||
|
||||
#[rustfmt::skip]
|
||||
type RngFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
||||
type RngFuture<'a>: Future<Output = Result<(), Self::Error> > + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
Self: 'a;
|
||||
|
||||
/// Completely fill the provided buffer with random bytes.
|
||||
///
|
||||
@ -15,9 +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>;
|
||||
}
|
||||
|
||||
pub trait Random: Rng {
|
||||
#[rustfmt::skip]
|
||||
type NextFuture<'a>: Future<Output = Result<u32, Self::Error>> + 'a
|
||||
type NextFuture<'a>: Future<Output = Result<u32, <Self as Rng>::Error>> + 'a
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
|
@ -13,7 +13,7 @@ use embassy_stm32::Peripherals;
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
use example_common::*;
|
||||
use embassy_stm32::rng::Random;
|
||||
use embassy::traits::rng::Rng;
|
||||
use embassy::traits::rng::Random as _;
|
||||
|
||||
#[embassy::main]
|
||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
|
Loading…
Reference in New Issue
Block a user