4 ms·
> We wanted a primitive that would guarantee that initialization of the global variables would happen exactly once. IIRC, At one time, there was a "lazy_static
by wyldfire 8y ago
> We wanted a primitive that would guarantee that initialization of the global variables would happen exactly once.
IIRC, At one time, there was a "lazy_static!" that fit this use case? But maybe you can't do that here if what you need is the side-effect of the library call.
- steveklabnik 8y agolazy_static is a wrapper around std::sync::Once, mentioned in the post. I'm not sure if it would be a better fit for the OP, as I haven't read their code.
- epage 8y agoAlso, there is `once_cell` that seems to be a more general form https://crates.io/crates/once_cell https://crates.io/crates/once_cell