Skip to main content

get_or_init

Function get_or_init 

Source
pub fn get_or_init<T: Sync + 'static>(cons: impl Fn() -> T) -> &'static T
Available on x86-64 or AArch64 or ARM or x86 only.
Expand description

Initialize & access the global initiable storage of type Type.

If this is called multiple times simultaneously, the cons argument of multiple invocations may be called, but only one result will be used.