From c40b944da6646ba9d7c6e99d7ca48bc3f87a652e Mon Sep 17 00:00:00 2001 From: Sebastian Goll Date: Wed, 9 Aug 2023 00:10:48 +0200 Subject: [PATCH] Mark Ticker stream as FusedStream --- embassy-time/src/timer.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index d3d1f9f5..ad5026e6 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs @@ -3,6 +3,7 @@ use core::pin::Pin; use core::task::{Context, Poll, Waker}; use futures_util::future::{select, Either}; +use futures_util::stream::FusedStream; use futures_util::{pin_mut, Stream}; use crate::{Duration, Instant}; @@ -163,6 +164,13 @@ impl Stream for Ticker { } } +impl FusedStream for Ticker { + fn is_terminated(&self) -> bool { + // `Ticker` keeps yielding values until dropped, it never terminates. + false + } +} + extern "Rust" { fn _embassy_time_schedule_wake(at: Instant, waker: &Waker); }