pub fn global<T: Zeroable + Sync + 'static>() -> &'static TExpand description
Access a global instance of T, zero-initialized at program start.
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);