File tree Expand file tree Collapse file tree 4 files changed +74
-2
lines changed Expand file tree Collapse file tree 4 files changed +74
-2
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ push :
3+ branches : [ staging, trying, master ]
4+ pull_request :
5+
6+ name : Clippy check
7+ jobs :
8+ clippy_check-async :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v2
12+ - uses : actions-rs/toolchain@v1
13+ with :
14+ profile : minimal
15+ toolchain : nightly
16+ override : true
17+ components : clippy
18+ - run : cargo clippy
19+ working-directory : embedded-hal-async
Original file line number Diff line number Diff line change 1818 - uses : actions-rs/clippy-check@v1
1919 with :
2020 token : ${{ secrets.GITHUB_TOKEN }}
21- - run : cargo clippy
22- working-directory : embedded-hal-async
Original file line number Diff line number Diff line change 1+ //! Delays
2+
3+ use core:: future:: Future ;
4+
5+ /// Microsecond delay
6+ pub trait DelayUs {
7+ /// Enumeration of errors
8+ type Error : core:: fmt:: Debug ;
9+
10+ /// The future returned by the `delay_us` function.
11+ type DelayUsFuture < ' a > : Future < Output = Result < ( ) , Self :: Error > > + ' a
12+ where
13+ Self : ' a ;
14+
15+ /// Pauses execution for at minimum `us` microseconds. Pause can be longer
16+ /// if the implementation requires it due to precision/timing issues.
17+ fn delay_us ( & mut self , us : u32 ) -> Self :: DelayUsFuture < ' _ > ;
18+
19+ /// The future returned by the `delay_ms` function.
20+ type DelayMsFuture < ' a > : Future < Output = Result < ( ) , Self :: Error > > + ' a
21+ where
22+ Self : ' a ;
23+
24+ /// Pauses execution for at minimum `ms` milliseconds. Pause can be longer
25+ /// if the implementation requires it due to precision/timing issues.
26+ fn delay_ms ( & mut self , ms : u32 ) -> Self :: DelayMsFuture < ' _ > ;
27+ }
28+
29+ impl < T > DelayUs for & mut T
30+ where
31+ T : DelayUs ,
32+ {
33+ type Error = T :: Error ;
34+
35+ type DelayUsFuture < ' a >
36+ where
37+ Self : ' a ,
38+ = T :: DelayUsFuture < ' a > ;
39+
40+ fn delay_us ( & mut self , us : u32 ) -> Self :: DelayUsFuture < ' _ > {
41+ T :: delay_us ( self , us)
42+ }
43+
44+ type DelayMsFuture < ' a >
45+ where
46+ Self : ' a ,
47+ = T :: DelayMsFuture < ' a > ;
48+
49+ fn delay_ms ( & mut self , ms : u32 ) -> Self :: DelayMsFuture < ' _ > {
50+ T :: delay_ms ( self , ms)
51+ }
52+ }
Original file line number Diff line number Diff line change 99
1010#![ deny( missing_docs) ]
1111#![ no_std]
12+ #![ feature( generic_associated_types) ]
13+
14+ pub mod delay;
You can’t perform that action at this time.
0 commit comments