mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
Implement FusedStream and FusedFuture for Interval and Delay (#1476)
This commit is contained in:
committed by
Lucio Franco
parent
68d5fcb8d1
commit
34a9dc2d76
@@ -91,6 +91,13 @@ impl Delay {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "async-traits")]
|
||||
impl futures_core::FusedFuture for Delay {
|
||||
fn is_terminated(&self) -> bool {
|
||||
self.is_elapsed()
|
||||
}
|
||||
}
|
||||
|
||||
impl Future for Delay {
|
||||
type Output = ();
|
||||
|
||||
|
||||
@@ -100,6 +100,13 @@ impl Interval {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "async-traits")]
|
||||
impl futures_core::FusedStream for Interval {
|
||||
fn is_terminated(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "async-traits")]
|
||||
impl futures_core::Stream for Interval {
|
||||
type Item = Instant;
|
||||
|
||||
Reference in New Issue
Block a user