Struct ffi_helpers::task::TaskHandle
[−]
[src]
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]
K: Task<Output = T> + UnwindSafe + Send + Sync + 'static,
T: Send + Sync + 'static,
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> Send for TaskHandle<T> where
T: Send,
T: Send,