Skip to content

Improvement: replace lazy_static with once_cell #19

Closed
@darnuria

Description

@darnuria

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions