Struct stream_cancel::Tripwire
source · pub struct Tripwire { /* private fields */ }
Expand description
A Tripwire
is a convenient mechanism for implementing graceful shutdown over many
asynchronous streams. A Tripwire
is a Future
that is Clone
, and that can be passed to
StreamExt::take_until_if
. All Tripwire
clones are associated with a single Trigger
,
which is then used to signal that all the associated streams should be terminated.
The Tripwire
future resolves to true
if the stream should be considered closed, and false
if the Trigger
has been disabled.
Tripwire
is internally implemented using a Shared<oneshot::Receiver<()>>
, with the
Trigger
holding the associated oneshot::Sender
. There is very little magic.
Implementations§
Trait Implementations§
impl<'pin> Unpin for Tripwirewhere
__Tripwire<'pin>: Unpin,
Auto Trait Implementations§
impl !RefUnwindSafe for Tripwire
impl Send for Tripwire
impl Sync for Tripwire
impl !UnwindSafe for Tripwire
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more