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

#2 in #late

Download history 5/week @ 2024-02-18 42/week @ 2024-02-25 30/week @ 2024-03-03 7/week @ 2024-03-10 5/week @ 2024-03-17

84 downloads per month
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