Skip to main content

scope_context

Function scope_context 

Source
pub async fn scope_context<F>(
    ctx: Option<ProgressContext>,
    future: F,
) -> F::Output
where F: Future,
Expand description

Run future with ctx installed as the active progress context. When ctx is None, the future runs without a context (so current_context returns None from inside it). Use this rather than installing into a thread-local: tool handlers are async and concurrent on the same OS thread, so we need per-task scoping.