3 ms·
My first instinct would be to use a static instance of `LazyLock`[1] wrapping the data (or `OnceLock`[2] if needed). `LazyLock` only just got stabilized, and `O
by saghm 2y ago
My first instinct would be to use a static instance of `LazyLock`[1] wrapping the data (or `OnceLock`[2] if needed). `LazyLock` only just got stabilized, and `OnceLock` only a bit less recently, but both have equivalents available via the `once_cell`[3] package for a while.
[1]: https://doc.rust-lang.org/std/sync/struct.LazyLock.html https://doc.rust-lang.org/std/sync/struct.LazyLock.html
[2]: https://doc.rust-lang.org/std/sync/struct.OnceLock.html https://doc.rust-lang.org/std/sync/struct.OnceLock.html
[3]: https://crates.io/crates/once_cell https://crates.io/crates/once_cell