solana_type_overrides::lazy_static

Function initialize

Source
pub fn initialize<T>(lazy: &T)
where T: LazyStatic,
Expand description

Takes a shared reference to a lazy static and initializes it if it has not been already.

This can be used to control the initialization point of a lazy static.

Example:

use lazy_static::lazy_static;

lazy_static! {
    static ref BUFFER: Vec<u8> = (0..255).collect();
}

fn main() {
    lazy_static::initialize(&BUFFER);

    // ...
    work_with_initialized_data(&BUFFER);
}