Function lazy_static::initialize

source ยท
pub fn initialize<T: LazyStatic>(lazy: &T)
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:

#[macro_use]
extern crate lazy_static;

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

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

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