pub struct TaskHandle<T> { /* private fields */ }Available on crate feature
async only.Expand description
Opaque handle returned by Context::spawn.
Store the handle and pass it to Context::poll on
subsequent frames. Dropping it cancels the task and discards its outcome.
Implementations§
Source§impl<T> TaskHandle<T>
impl<T> TaskHandle<T>
Sourcepub fn cancel(&mut self)
pub fn cancel(&mut self)
Request cancellation while keeping the terminal outcome observable.
This method is idempotent. Continue polling the handle to observe
TaskOutcome::Cancelled once the runtime acknowledges the abort.
Trait Implementations§
Source§impl<T> Debug for TaskHandle<T>
impl<T> Debug for TaskHandle<T>
Source§impl<T> Drop for TaskHandle<T>
impl<T> Drop for TaskHandle<T>
Auto Trait Implementations§
impl<T> Freeze for TaskHandle<T>
impl<T> RefUnwindSafe for TaskHandle<T>
impl<T> Send for TaskHandle<T>
impl<T> Sync for TaskHandle<T>
impl<T> Unpin for TaskHandle<T>
impl<T> UnsafeUnpin 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