We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent caea9b1 commit 88bd185Copy full SHA for 88bd185
futures-channel/src/oneshot.rs
@@ -7,7 +7,7 @@ use core::fmt;
7
use core::pin::Pin;
8
use core::sync::atomic::AtomicBool;
9
use core::sync::atomic::Ordering::SeqCst;
10
-use futures_core::future::Future;
+use futures_core::future::{Future, FusedFuture};
11
use futures_core::task::{Context, Poll, Waker};
12
13
use crate::lock::Lock;
@@ -461,6 +461,21 @@ impl<T> Future for Receiver<T> {
461
}
462
463
464
+impl<T> FusedFuture for Receiver<T> {
465
+ fn is_terminated(&self) -> bool {
466
+ if self.inner.complete.load(SeqCst) {
467
+ if let Some(slot) = self.inner.data.try_lock() {
468
+ if slot.is_some() {
469
+ return false;
470
+ }
471
472
+ true
473
+ } else {
474
+ false
475
476
477
+}
478
+
479
impl<T> Drop for Receiver<T> {
480
fn drop(&mut self) {
481
self.inner.drop_rx()
0 commit comments