[][src]Struct futures_util::future::Abortable

#[must_use = "futures do nothing unless polled"]
pub struct Abortable<Fut> { /* fields omitted */ }

A future which can be remotely short-circuited using an AbortHandle.

Methods

impl<Fut> Abortable<Fut> where
    Fut: Future
[src]

Creates a new Abortable future using an existing AbortRegistration. AbortRegistrations can be acquired through AbortHandle::new.

When abort is called on the handle tied to reg or if abort has already been called, the future will complete immediately without making any further progress.

Example:

use futures::future::{ready, Abortable, AbortHandle, Aborted};
use futures::executor::block_on;

let (abort_handle, abort_registration) = AbortHandle::new_pair();
let future = Abortable::new(ready(2), abort_registration);
abort_handle.abort();
assert_eq!(block_on(future), Err(Aborted));

Trait Implementations

impl<Fut: Debug> Debug for Abortable<Fut>
[src]

Formats the value using the given formatter. Read more

impl<Fut: Clone> Clone for Abortable<Fut>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Fut: Unpin> Unpin for Abortable<Fut>
[src]

impl<Fut> Future for Abortable<Fut> where
    Fut: Future
[src]

🔬 This is a nightly-only experimental API. (futures_api)

futures in libcore are unstable

The result of the Future.

🔬 This is a nightly-only experimental API. (futures_api)

futures in libcore are unstable

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more

Auto Trait Implementations

impl<Fut> Send for Abortable<Fut> where
    Fut: Send

impl<Fut> Sync for Abortable<Fut> where
    Fut: Sync