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

Improvement: replace lazy_static with once_cell #19

Closed
darnuria opened this issue Nov 23, 2022 · 1 comment
Closed

Improvement: replace lazy_static with once_cell #19

darnuria opened this issue Nov 23, 2022 · 1 comment

Comments

@darnuria
Copy link
Contributor

Hello,

I would suggest to change lazy_static for once_cell, lazy static was needed because back in 2015 in rust 1.0 it was impossible to express something like a compile time shared global ressource but safely accessed.

Since 2019, it's possible with : https://github.com/matklad/once_cell also the author openned a RFC PR 0000-standard-lazy-types.md to make it in std Tracking Issue for once_cell

It's used here : https://github.com/Gandi/jbod-rs/blob/main/src/prometheus.rs#L54-L71 and maybe used for regex compiled on the fly.

Gains:

  • Less macro code
  • API in standardisation
@araujobsd
Copy link
Collaborator

as it is not a critical issue, I'm closing this issue! Please, feel free to submit a PR with the proper changes.

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

No branches or pull requests

2 participants