Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from lazy_static to once_cell #71

Open
james7132 opened this issue Jun 4, 2022 · 1 comment · May be fixed by #72
Open

Migrate from lazy_static to once_cell #71

james7132 opened this issue Jun 4, 2022 · 1 comment · May be fixed by #72

Comments

@james7132
Copy link

lazy_static involves macros, takes a bit longer to compile, and once_cell provides more flexible ways on the way to being added to std. Replace all usages of lazy_static with static VAR: Lazy<T>.

One potential drawback is that lazy_static supports spin-waiting on the result, while Lazy doesn't. I don't think any of the crate's usages are perf-bound by this though.

@notgull
Copy link

notgull commented Jun 4, 2022

The spin crate supports spinning on the result with a spin::OnceCell, which you can use on a feature flag.

@james7132 james7132 linked a pull request Jun 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants