Mark Ticker stream as FusedStream

This commit is contained in:
Sebastian Goll 2023-08-09 00:10:48 +02:00
parent 47b8e04b1c
commit c40b944da6

View file

@ -3,6 +3,7 @@ use core::pin::Pin;
use core::task::{Context, Poll, Waker}; use core::task::{Context, Poll, Waker};
use futures_util::future::{select, Either}; use futures_util::future::{select, Either};
use futures_util::stream::FusedStream;
use futures_util::{pin_mut, Stream}; use futures_util::{pin_mut, Stream};
use crate::{Duration, Instant}; 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" { extern "Rust" {
fn _embassy_time_schedule_wake(at: Instant, waker: &Waker); fn _embassy_time_schedule_wake(at: Instant, waker: &Waker);
} }