Skip to main content

InitStatic

Macro InitStatic 

Source
macro_rules! InitStatic {
    ($ident:ident) => { ... };
}
Expand description

Creates a new uninitialized InitStatic<T> instance with source location metadata.

This macro is a convenience wrapper around InitStatic::new that automatically captures the source location using the Symbol! macro.

ยงExample

use init_static::InitStatic;

struct Config; // Placeholder for some configuration type

static MY_CONFIG: InitStatic<Config> = InitStatic!(MY_CONFIG);

// The static is uninitialized and will panic if accessed before initialization.
// Use `InitStatic::init(&MY_CONFIG, value)` to initialize it.