[][src]Macro tokio::task_local

macro_rules! task_local {
    () => { ... };
    ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty; $($rest:tt)*) => { ... };
    ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty) => { ... };
}

Declare a new task local storage key of type tokio::task::LocalKey.

Syntax

The macro wraps any number of static declarations and makes them task locals. Publicity and attributes for each static are allowed.

Examples

task_local! {
    pub static FOO: u32;

    #[allow(unused)]
    static BAR: f32;
}

See LocalKey documentation for more information.