Skip to main content

scope

Function scope 

Source
pub fn scope<F: Future>(
    ctx: RequestContext,
    future: F,
) -> impl Future<Output = F::Output>
Expand description

Runs future with ctx as the ambient context returned by current.

Scopes nest. When future completes, the previous ambient context is back in place.

The context is also in place when future is dropped, even if it was never polled, for example in a spawned task that is aborted before it starts.