[][src]Struct ffi_helpers::task::TaskHandle

pub struct TaskHandle<T> { /* fields omitted */ }

An opaque handle to some task which is running in the background.

Methods

impl<T> TaskHandle<T>[src]

pub fn spawn<K>(task: K) -> TaskHandle<T> where
    K: Task<Output = T> + UnwindSafe + Send + Sync + 'static,
    T: Send + Sync + 'static, 
[src]

Spawn a Task in the background, returning the a TaskHandle so you can cancel it or retrieve the result later on.

pub fn poll(&self) -> Option<Result<T, Error>>[src]

Check if the background task has finished.

If the other end hangs up for whatever reason this will return an error.

pub fn wait(self) -> Result<T, Error>[src]

Block the current thread until the task has finished and returned a result.

pub fn cancel(&self)[src]

Cancel the background task.

pub fn cancelled(&self) -> bool[src]

Has this task been cancelled?

Trait Implementations

impl<T> Drop for TaskHandle<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for TaskHandle<T>

impl<T> Send for TaskHandle<T> where
    T: Send

impl<T> !Sync for TaskHandle<T>

impl<T> Unpin for TaskHandle<T>

impl<T> !UnwindSafe for TaskHandle<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.