Macro tokio::task_local
source · macro_rules! task_local { () => { ... }; ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty; $($rest:tt)*) => { ... }; ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty) => { ... }; }
Expand description
Declares a new task-local key of type tokio::task::LocalKey
.
Syntax
The macro wraps any number of static declarations and makes them local to the current task. Publicity and attributes for each static is preserved. For example:
Examples
task_local! {
pub static ONE: u32;
#[allow(unused)]
static TWO: f32;
}
See LocalKey
documentation for more
information.