[−][src]Function threadstack::clone_thread_stack_value
pub fn clone_thread_stack_value<T: Clone, U: IsThreadStack<T>>(
stack: &'static LocalKey<U>
) -> T
Clone the value currently at the top of threadstack. This lets you avoid worrying about lifetimes but does require a clone to be made. This can panic only if nothing has been pushed onto the threadstack and it was created without an initial value.
use threadstack::*; declare_thread_stacks!( FOO: String = String::from("hello world"); ); assert!(clone_thread_stack_value(&FOO) == "hello world");