pub struct Task<T> { /* private fields */ }Available on Windows only.
Expand description
A future result of a task.
Dropping it before it resolves cancels the task.
Implementations§
Source§impl<T> Task<T>
impl<T> Task<T>
Sourcepub fn cancel(self: Pin<&mut Self>)
pub fn cancel(self: Pin<&mut Self>)
Requests cancellation without dropping the task.
The task can be awaited afterward to join it. An unguarded task
resolves with TaskCanceled; a task inside
Context::cancel_guard can run cooperative cleanup and produce its
normal result instead.
Trait Implementations§
impl<T: Send> Sync for Task<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Task<T>
impl<T> !Unpin for Task<T>
impl<T> !UnsafeUnpin for Task<T>
impl<T> !UnwindSafe for Task<T>
impl<T> Freeze for Task<T>where
PhantomData<T>: Freeze,
impl<T> Send for Task<T>where
PhantomData<T>: Send,
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
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more