[−][src]Macro threadstack::push_thread_stack_value
Push a new value on the top of the threadstack. This value becomes
the value that will be returned by clone_thread_stack_value
and
that let_ref_thread_stack_value!
will create a reference to. Can
only be invoked inside a function, and the effect will last until
the end of the current scope. Pushing a new value onto the
threadstack will never panic. The assumption is that threadstacks
are mostly used for infrequently set context data, or
configuration settings that would otherwise be global variables.
use threadstack::*; declare_thread_stacks!( FOO: String = String::from("hello world"); ); assert!(clone_thread_stack_value(&FOO) == "hello world"); { push_thread_stack_value!("hello universe".into(), FOO); assert!(clone_thread_stack_value(&FOO) == "hello universe"); } assert!(clone_thread_stack_value(&FOO) == "hello world");