pub struct ScopeFuture<Fut, Joiner>where
Fut: Future,{ /* private fields */ }
Expand description
A future that manages a scope.
This future is created by scope
function.
Implementations§
Source§impl<Fut, Joiner> ScopeFuture<Fut, Joiner>where
Fut: Future,
impl<Fut, Joiner> ScopeFuture<Fut, Joiner>where
Fut: Future,
Sourcepub fn cancel(self: Pin<&mut Self>)
pub fn cancel(self: Pin<&mut Self>)
Initiates a graceful cancellation.
This function will send a wakeup signal to all the cancellation futures in the scope. Tasks in the scope can continue execution, but they are expected to stop the subsequent processing during the grace period.
The cancellation signal will be automatically delivered to all scopes inside self
.
Sourcepub fn force_cancel(self: Pin<&mut Self>)
pub fn force_cancel(self: Pin<&mut Self>)
Cancels all the tasks in the scope forcibly. Tasks within the scope enter a mercy period. They can do the last cleanup before exitting but will be automatically stopped at the next yield.
Tasks should shorten the mercy period as short as possible by introducing a cancellation point regularly, because it’s a kind of violation of Structured Concurrency (children are outliving the dropped parent).
Trait Implementations§
Source§impl<Fut, Joiner> FusedFuture for ScopeFuture<Fut, Joiner>
impl<Fut, Joiner> FusedFuture for ScopeFuture<Fut, Joiner>
Source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true
if the underlying future should no longer be polled.Source§impl<Fut, Joiner> Future for ScopeFuture<Fut, Joiner>
impl<Fut, Joiner> Future for ScopeFuture<Fut, Joiner>
impl<'pin, Fut, Joiner> Unpin for ScopeFuture<Fut, Joiner>
Auto Trait Implementations§
impl<Fut, Joiner> Freeze for ScopeFuture<Fut, Joiner>
impl<Fut, Joiner> !RefUnwindSafe for ScopeFuture<Fut, Joiner>
impl<Fut, Joiner> Send for ScopeFuture<Fut, Joiner>
impl<Fut, Joiner> !Sync for ScopeFuture<Fut, Joiner>
impl<Fut, Joiner> !UnwindSafe for ScopeFuture<Fut, Joiner>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.