diff options
Diffstat (limited to 'embassy-time/src/timer.rs')
| -rw-r--r-- | embassy-time/src/timer.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index f74b5cb24..416830a7c 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs | |||
| @@ -3,7 +3,7 @@ use core::pin::Pin; | |||
| 3 | use core::task::{Context, Poll, Waker}; | 3 | use core::task::{Context, Poll, Waker}; |
| 4 | 4 | ||
| 5 | use futures_util::future::{select, Either}; | 5 | use futures_util::future::{select, Either}; |
| 6 | use futures_util::{pin_mut, Stream}; | 6 | use futures_util::{pin_mut, Stream, StreamExt}; |
| 7 | 7 | ||
| 8 | use crate::{Duration, Instant}; | 8 | use crate::{Duration, Instant}; |
| 9 | 9 | ||
| @@ -132,6 +132,11 @@ impl Ticker { | |||
| 132 | let expires_at = Instant::now() + duration; | 132 | let expires_at = Instant::now() + duration; |
| 133 | Self { expires_at, duration } | 133 | Self { expires_at, duration } |
| 134 | } | 134 | } |
| 135 | |||
| 136 | /// Waits for the next tick | ||
| 137 | pub async fn next(&mut self) { | ||
| 138 | <Self as StreamExt>::next(self).await; | ||
| 139 | } | ||
| 135 | } | 140 | } |
| 136 | 141 | ||
| 137 | impl Unpin for Ticker {} | 142 | impl Unpin for Ticker {} |
