News for hackers. Stuff that matters.
Re:Rust – How do I create a global, mutable singleton? (2015) by pornel on Thursday July 23, 2020 @07:04AM (#23926064)
Rust has https://lib.rs/once_cell for this. It's a wrapper type that ensures something can be written to only once, atomically, and after that it's immutable, so it can be shared freely.

It's not a program-wide stage, but it's sufficient to use it in `main()` to make it behave like that.

There are no comments on this comment yet.