pub(crate) struct AbortableHandle {
abort_handle: RefCell<Option<AbortHandle>>,
}Expand description
A wrapper around JoinHandle that aborts the future if it is dropped
before the task ends.
The main API for this type is AbortableHandle::await_task().
Fields§
§abort_handle: RefCell<Option<AbortHandle>>Implementations§
Source§impl AbortableHandle
impl AbortableHandle
Sourcepub(crate) async fn await_task<T>(
&self,
join_handle: JoinHandle<T>,
) -> Option<T>
pub(crate) async fn await_task<T>( &self, join_handle: JoinHandle<T>, ) -> Option<T>
Await the task of the given JoinHandle.
Aborts the previous task that was running, if any.
Returns None if the task was aborted before completion.
Trait Implementations§
Source§impl Debug for AbortableHandle
impl Debug for AbortableHandle
Source§impl Default for AbortableHandle
impl Default for AbortableHandle
Source§fn default() -> AbortableHandle
fn default() -> AbortableHandle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for AbortableHandle
impl !RefUnwindSafe for AbortableHandle
impl Send for AbortableHandle
impl !Sync for AbortableHandle
impl Unpin for AbortableHandle
impl UnsafeUnpin for AbortableHandle
impl UnwindSafe for AbortableHandle
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<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more