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§
Sourcefn scope<F, R>(
locals: TaskLocals,
fut: F,
) -> Pin<Box<dyn Future<Output = R> + Send>>
fn scope<F, R>( locals: TaskLocals, fut: F, ) -> Pin<Box<dyn Future<Output = R> + Send>>
Set the task locals for the given future
Sourcefn get_task_locals() -> Option<TaskLocals>
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.