Skip to main content

Module non_zeroable_global

Module non_zeroable_global 

Source
Available on x86-64 or AArch64 or ARM or x86 only.
Expand description

Access a generic global that can contain non-zeroable types. This is done via an indirection to the heap, so use global if this is not needed.

This doesn’t interfere with data accessed with global.

§Example

#[derive(PartialEq, Debug)]
struct MyType;

assert_eq!(non_zeroable_global::get::<MyType>(), None);
let _ = non_zeroable_global::init(MyType);
assert_eq!(non_zeroable_global::get::<MyType>(), Some(&MyType));

Structs§

AlreadyInitialized

Functions§

get
Access the global initiable storage of type Type.
get_or_init
Initialize & access the global initiable storage of type Type.
init
Initialize the global initiable storage of type Type.