pub fn global<T: Zeroable + Sync + 'static>() -> &'static TAvailable on crate feature
std or x86-64 or AArch64 or ARM or x86 only.Expand description
Access a zero-initialized global static instance of T.
For types that cannot be zero-initialized, use non_zeroable_global.
ยงExample
struct MyType(AtomicI32);
unsafe impl bytemuck::Zeroable for MyType {}
assert_eq!(generic_static_cache::global::<MyType>().0.load(Relaxed), 0);
generic_static_cache::global::<MyType>().0.store(1, Relaxed);
assert_eq!(generic_static_cache::global::<MyType>().0.load(Relaxed), 1);
assert_eq!(*generic_static_cache::global::<i32>(), 0);