[][src]Macro threadstack::declare_thread_stacks

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

Macro used to declare one or more thread stacks. The syntax pretty closely mirrors thread_local! from the standard library, except that the static key word is not used.

Example

   use threadstack::declare_thread_stacks;

   declare_thread_stacks!(
       FOO: u32 = 0xDEADBEEFu32;
       pub BAR: u32 = 0xDEADBEEFu32;
       BUZZ: String;
   );

Note that the value on the right side of the equal sign is only the initial value (which may be overridden by calls to push_thread_stack_value). Providing an initial value guarantees that accessing the top of the stack through let_ref_thread_stack_value or clone_thread_stack_value will never panic. Otherwise they may panic if no value has ever been pushed.