Trait ContextExt

Source
pub trait ContextExt: Runtime {
    // Required methods
    fn scope<F, R>(
        locals: TaskLocals,
        fut: F,
    ) -> Pin<Box<dyn Future<Output = R> + Send>>
       where F: Future<Output = R> + Send + 'static;
    fn get_task_locals() -> Option<TaskLocals>;
}
Expand description

Exposes the utilities necessary for using task-local data in the Runtime

Required Methods§

Source

fn scope<F, R>( locals: TaskLocals, fut: F, ) -> Pin<Box<dyn Future<Output = R> + Send>>
where F: Future<Output = R> + Send + 'static,

Set the task locals for the given future

Source

fn get_task_locals() -> Option<TaskLocals>

Get the task locals for the current task

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§