diff --git a/futures-channel/src/oneshot.rs b/futures-channel/src/oneshot.rs index 5f76cee4b9..8d160066fb 100644 --- a/futures-channel/src/oneshot.rs +++ b/futures-channel/src/oneshot.rs @@ -377,6 +377,12 @@ impl Sender { pub fn is_canceled(&self) -> bool { self.inner.is_canceled() } + + /// Tests to see whether this `Sender` is connected to the given `Receiver`. That is, whether + /// they were created by the same call to `channel`. + pub fn is_connected_to(&self, receiver: &Receiver) -> bool { + Arc::ptr_eq(&self.inner, &receiver.inner) + } } impl Drop for Sender {