pub struct AbortOnDrop<T: Send + 'static>(/* private fields */);Expand description
Calls Handle::abort when dropped.
Supervision ties spawned tasks to their spawning task’s lifetime, but work spawned from a plain
future outlives that future’s drop. Wrapping the handle (see Handle::abort_on_drop) ties the
task’s cancellation to the guard instead. Dropping the guard signals cancellation. Use
AbortOnDrop::abort to also join the handle. Completion handles only stop waiting and
do not cancel the underlying work (see Handle).
Implementations§
Source§impl<T: Send + 'static> AbortOnDrop<T>
impl<T: Send + 'static> AbortOnDrop<T>
Source§impl<T, E1> AbortOnDrop<Result<T, E1>>
impl<T, E1> AbortOnDrop<Result<T, E1>>
Sourcepub fn join_all<E2>(
guards: Vec<Self>,
) -> impl Future<Output = Result<Vec<T>, E2>>
pub fn join_all<E2>( guards: Vec<Self>, ) -> impl Future<Output = Result<Vec<T>, E2>>
Join guards in order, collecting each task’s output.
On the first failure (a task error or a failed join), abort every remaining guard, discard collected outputs, and drain the remaining guards concurrently before surfacing the error. Joining in order makes the surfaced failure deterministic.
Spawned tasks are cancelled and joined. Completion handles only stop waiting for their underlying work.
Dropping the returned future signals every cancellation before destroying any owned outputs or completion futures.
Trait Implementations§
Source§impl<T: Send + 'static> Drop for AbortOnDrop<T>
impl<T: Send + 'static> Drop for AbortOnDrop<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for AbortOnDrop<T>
impl<T> !UnwindSafe for AbortOnDrop<T>
impl<T> Freeze for AbortOnDrop<T>
impl<T> Send for AbortOnDrop<T>
impl<T> Sync for AbortOnDrop<T>
impl<T> Unpin for AbortOnDrop<T>
impl<T> UnsafeUnpin for AbortOnDrop<T>where
Handle<T>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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<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> ⓘ
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> ⓘ
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