[−][src]Struct ffi_helpers::task::TaskHandle
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> !RefUnwindSafe for TaskHandle<T>
impl<T> Send for TaskHandle<T> where
T: Send,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,