pub struct Task<T> { /* private fields */ }
Expand description
A task that can be spawned onto a TaskPool
.
Note Tasks are cancelled when dropped.
Implementations§
source§impl<T> Task<T>
impl<T> Task<T>
sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns true if the task has completed.
sourcepub async fn cancel(self)
pub async fn cancel(self)
Cancels the task and waits for it to cancel. As opposed to dropping it.
sourcepub fn cancel_blocking(self)
pub fn cancel_blocking(self)
Cancels the task and waits for it to cancel.
This is equivalent to blocking on Task::cancel
.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Task<T>
impl<T> Send for Task<T>where T: Send,
impl<T> Sync for Task<T>
impl<T> Unpin for Task<T>
impl<T> UnwindSafe for Task<T>
Blanket Implementations§
source§impl<F> FutureExt for Fwhere
F: Future + ?Sized,
impl<F> FutureExt for Fwhere F: Future + ?Sized,
source§fn race<F>(self, other: F) -> Race<Self, F>where
Self: Sized,
F: Future<Output = Self::Output>,
fn race<F>(self, other: F) -> Race<Self, F>where Self: Sized, F: Future<Output = Self::Output>,
source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where Self: Sized + UnwindSafe,
Catches panics while polling the future. Read more
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere F: Future,
§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