Struct futures::future::Abortable[][src]

#[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::prelude::*;
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> Unpin for Abortable<Fut> where
    Fut: Unpin
[src]

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Formats the value using the given formatter. Read more

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