pub struct Task<T> { /* private fields */ }Expand description
the handle of a spawned task; dropping it cancels the task (detach keeps it running)
Implementations§
Source§impl<T> Task<T>
impl<T> Task<T>
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
finished, cancelled or dropped by its executor (the future is gone or goes with the executor’s next run)
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
it ended without a value: cancel() came first, or its executor went away
Sourcepub fn take(&self) -> Option<T>
pub fn take(&self) -> Option<T>
the result, once (None: still running, cancelled or already taken)
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Task<T>
impl<T> !UnwindSafe for Task<T>
impl<T> Forget for Task<T>
impl<T> Freeze for Task<T>
impl<T> Send for Task<T>
impl<T> Sync for Task<T>
impl<T> Unpin for Task<T>
impl<T> UnsafeUnpin for Task<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
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