pub struct TaskHandle<T> { /* private fields */ }Expand description
An owned tokio task, aborted when the handle drops.
Dropping the handle requests cancellation and returns at once: the task’s future is dropped at its next yield point, possibly after the drop returns. A task blocking its thread, never yielding, is not stopped.
Awaiting the handle yields the task’s output, or a JoinError when the
task panicked or was aborted. The await is cancel safe: polling stops
without losing the output, and the handle can be awaited again.
Implementations§
Source§impl<T> TaskHandle<T>
impl<T> TaskHandle<T>
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether the task has ended, by returning, panicking or being aborted.
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>
Source§impl<T> Future for TaskHandle<T>
impl<T> Future for TaskHandle<T>
Auto Trait Implementations§
impl<T> Freeze for TaskHandle<T>where
JoinHandle<T>: Freeze,
impl<T> RefUnwindSafe for TaskHandle<T>where
JoinHandle<T>: RefUnwindSafe,
impl<T> Send for TaskHandle<T>where
JoinHandle<T>: Send,
impl<T> Sync for TaskHandle<T>where
JoinHandle<T>: Sync,
impl<T> Unpin for TaskHandle<T>where
JoinHandle<T>: Unpin,
impl<T> UnsafeUnpin for TaskHandle<T>where
JoinHandle<T>: UnsafeUnpin,
impl<T> UnwindSafe for TaskHandle<T>where
JoinHandle<T>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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