pub struct JoinHandle<T> { /* private fields */ }Expand description
A spawned task (Bot::spawn): await it for its result, or JoinHandle::abort it.
Dropping the handle does not stop the task.
Implementations§
Source§impl<T> JoinHandle<T>
impl<T> JoinHandle<T>
Sourcepub fn abort(&self)
pub fn abort(&self)
Stops the task at the next tick (it is dropped, which cancels what it awaits).
let h = bot.spawn(async {});
h.abort();Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether the task finished (or was cancelled).
let h = bot.spawn(async {});
bot.next_tick().await;
assert!(h.is_finished());Trait Implementations§
Source§impl<T> Debug for JoinHandle<T>
impl<T> Debug for JoinHandle<T>
Source§impl<T> Future for JoinHandle<T>
impl<T> Future for JoinHandle<T>
Auto Trait Implementations§
impl<T> Forget for JoinHandle<T>
impl<T> Freeze for JoinHandle<T>
impl<T> Move for JoinHandle<T>
impl<T> RefUnwindSafe for JoinHandle<T>
impl<T> Send for JoinHandle<T>
impl<T> Sync for JoinHandle<T>
impl<T> Unpin for JoinHandle<T>
impl<T> UnsafeUnpin for JoinHandle<T>
impl<T> UnwindSafe for JoinHandle<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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