3 ms·
Rust doesn't have static initialisers for complex objects; it has lazy initialisers in the standard library that run when they're first requested, but there's n
by Philpax 2y ago
Rust doesn't have static initialisers for complex objects; it has lazy initialisers in the standard library that run when they're first requested, but there's no way to statically initialise any object more complex than a primitive: https://doc.rust-lang.org/reference/items/static-items.html#r-items.static.init https://doc.rust-lang.org/reference/items/static-items.html#...
- fpoling 2y agoThanks, I stand corected. Rust does not allow to initialize globals with arbitrary code running before main even with unsafe. One more point to consider Rust over C++.