diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-08-08 23:14:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-08 23:14:24 +0000 |
| commit | b7114fb9513bd7b2cbf40f7f63e17c8125745844 (patch) | |
| tree | fa471a03309b59ff72b4a6e25e115f5978bd63e3 | |
| parent | d375c46590e25907b999fad22383cb912e2774f4 (diff) | |
| parent | c40b944da6646ba9d7c6e99d7ca48bc3f87a652e (diff) | |
Merge pull request #1761 from sgoll/fuse-ticker
Mark `Ticker` stream as fused
| -rw-r--r-- | embassy-time/src/timer.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index d3d1f9f5f..ad5026e62 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs | |||
| @@ -3,6 +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::stream::FusedStream; | ||
| 6 | use futures_util::{pin_mut, Stream}; | 7 | use futures_util::{pin_mut, Stream}; |
| 7 | 8 | ||
| 8 | use crate::{Duration, Instant}; | 9 | use crate::{Duration, Instant}; |
| @@ -163,6 +164,13 @@ impl Stream for Ticker { | |||
| 163 | } | 164 | } |
| 164 | } | 165 | } |
| 165 | 166 | ||
| 167 | impl FusedStream for Ticker { | ||
| 168 | fn is_terminated(&self) -> bool { | ||
| 169 | // `Ticker` keeps yielding values until dropped, it never terminates. | ||
| 170 | false | ||
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 166 | extern "Rust" { | 174 | extern "Rust" { |
| 167 | fn _embassy_time_schedule_wake(at: Instant, waker: &Waker); | 175 | fn _embassy_time_schedule_wake(at: Instant, waker: &Waker); |
| 168 | } | 176 | } |
