Macro zng::hot_reload::hot_static

source ยท
macro_rules! hot_static {
    (
        static $IDENT:ident: $Ty:ty = $init:expr;
    ) => { ... };
}
Expand description

Declares a patchable static.

In builds with Cargo feature hot_reload this generates an unsafe static double reference that can be addressed by name and patched in a dynamically loaded build of the exact same crate.

Use hot_static_ref! to safely reference the static, attempting to access the variable in any other way is undefined behavior.

Note that you can only declare private static items, this is by design, you can share the hot_static_ref! output at a higher visibility.

See zng::hot_reload for more details and links to the full API. This macro is declared on the zng-unique-id crate only to avoid circular dependencies in the Zng workspace.