4 releases (breaking)

0.4.0 Nov 12, 2020
0.3.0 Feb 5, 2019
0.2.0 Feb 4, 2019
0.1.0 Feb 4, 2019

#1 in #late


Used in efw

MIT license

7KB
126 lines

late-static Latest Version Build Status

Initialize static variables at runtime.


Please refer to the latest docs.


lib.rs:

Initialize variables at runtime which then behave like static variables.

extern crate late_static;
use late_static::LateStatic;

struct Foo {
    pub value: u32,
}

static FOO: LateStatic<Foo> = LateStatic::new();

fn main() {
    unsafe {
        LateStatic::assign(&FOO, Foo { value: 42 });
    }
    println!("{}", FOO.value);
}

No runtime deps