1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use core::future::Future;
pub trait DelayUs {
type Error: core::fmt::Debug;
type DelayUsFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
fn delay_us(&mut self, us: u32) -> Self::DelayUsFuture<'_>;
type DelayMsFuture<'a>: Future<Output = Result<(), Self::Error>>
where
Self: 'a;
fn delay_ms(&mut self, ms: u32) -> Self::DelayMsFuture<'_>;
}
impl<T> DelayUs for &mut T
where
T: DelayUs,
{
type Error = T::Error;
type DelayUsFuture<'a> = T::DelayUsFuture<'a> where Self: 'a;
fn delay_us(&mut self, us: u32) -> Self::DelayUsFuture<'_> {
T::delay_us(self, us)
}
type DelayMsFuture<'a> = T::DelayMsFuture<'a> where Self: 'a;
fn delay_ms(&mut self, ms: u32) -> Self::DelayMsFuture<'_> {
T::delay_ms(self, ms)
}
}