pub struct TaskHandle<T> { /* private fields */ }
Expand description
An opaque handle to some task which is running in the background.
Implementations§
Source§impl<T> TaskHandle<T>
impl<T> TaskHandle<T>
Sourcepub fn spawn<K>(task: K) -> TaskHandle<T>
pub fn spawn<K>(task: K) -> TaskHandle<T>
Spawn a Task
in the background, returning the a TaskHandle
so you
can cancel it or retrieve the result later on.
Sourcepub fn poll(&self) -> Option<Result<T, Error>>
pub fn poll(&self) -> Option<Result<T, Error>>
Check if the background task has finished.
If the other end hangs up for whatever reason this will return an error.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TaskHandle<T>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more