pub struct Cancellable<F> { /* private fields */ }Expand description
A future that resolves to Some(output) when inner completes, or to
None as soon as the token is cancelled, dropping inner first.
Async launchers for cancellable functions wrap the producer’s future in
one of these. The waker is registered on the token before the flag is
checked, so a cancellation racing a poll is never missed.
Implementations§
Source§impl<F: Future> Cancellable<F>
impl<F: Future> Cancellable<F>
Sourcepub fn new(fut: F, token: CancelToken) -> Self
pub fn new(fut: F, token: CancelToken) -> Self
Race fut against token. A handle on a null token never cancels.
Trait Implementations§
Source§impl<F: Debug> Debug for Cancellable<F>
impl<F: Debug> Debug for Cancellable<F>
Source§impl<F> Drop for Cancellable<F>
impl<F> Drop for Cancellable<F>
Source§impl<F: Future> Future for Cancellable<F>
impl<F: Future> Future for Cancellable<F>
Auto Trait Implementations§
impl<F> !RefUnwindSafe for Cancellable<F>
impl<F> !UnwindSafe for Cancellable<F>
impl<F> Freeze for Cancellable<F>
impl<F> Send for Cancellable<F>where
F: Send,
impl<F> Sync for Cancellable<F>where
F: Sync,
impl<F> Unpin for Cancellable<F>
impl<F> UnsafeUnpin for Cancellable<F>
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,
Source§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