time: implement FusedStream for IntervalStream (#7854)

This commit is contained in:
Finn Sheng
2026-01-14 14:49:03 +01:00
committed by GitHub
parent 240cc44da8
commit b88c02c55e
2 changed files with 19 additions and 0 deletions
+12
View File
@@ -48,3 +48,15 @@ async fn basic_usage() {
assert_eq!(stream.next().await, None);
assert_eq!(stream.size_hint(), (0, Some(0)));
}
#[tokio::test]
#[cfg(feature = "time")]
async fn interval_stream_is_never_terminated() {
use futures_core::stream::FusedStream;
use tokio_stream::wrappers::IntervalStream;
let interval = tokio::time::interval(std::time::Duration::from_millis(1));
let stream = IntervalStream::new(interval);
assert!(!stream.is_terminated());
}