Macro generic_static_cache::generic_static
source · macro_rules! generic_static { {static $ident:ident : &$type:ty = &$init:expr;} => { ... }; }
Expand description
Declare a static variable that is not shared across different monomorphizations of the containing functions. Its type must be a shared reference to a type that implements Sync.
Only available on supported targets; to support all platforms use fallback_generic_static
.
Example
#![feature(const_collections_with_hasher)]
generic_static!{
static name: &Mutex<String> = &Mutex::new("Ferris".to_string());
}