Move initialisation inside of future

This commit is contained in:
Liam Murphy 2021-06-30 09:45:49 +10:00
parent 8a4ab29819
commit ae0219de6f

View file

@ -97,10 +97,10 @@ impl<'d> traits::rng::Rng for Rng<'d> {
type RngFuture<'a> where 'd: 'a = impl Future<Output = Result<(), Self::Error>> + 'a; type RngFuture<'a> where 'd: 'a = impl Future<Output = Result<(), Self::Error>> + 'a;
fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a> { fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a> {
async move {
self.enable_irq(); self.enable_irq();
self.start(); self.start();
async move {
let on_drop = OnDrop::new(|| { let on_drop = OnDrop::new(|| {
self.stop(); self.stop();
self.disable_irq(); self.disable_irq();