Expand description
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);
}
Structsยง
- Late
Static - Static value that is manually initialized at runtime.