rust-cookbook icon indicating copy to clipboard operation
rust-cookbook copied to clipboard

Replace lazy_static with once_cell

Open nindalf opened this issue 3 years ago • 1 comments
trafficstars

lazy_static is used throughout the cookbook to store data that should be initialised only once. once_cell is more flexible and convenient than lazy_static. For example, it can be used for local variables.

Integrating once_cell into the standard library is in progress - issue.

I propose that the cookbook change to using once_cell instead. Once it has been integrated into the standard library, the imports alone can be changed. Until then the cookbook could reflect best practice, which is to use once_cell.

nindalf avatar Jan 25 '22 23:01 nindalf

nice idea. I'm working on a rewrite, and welcome to revamping the cookbook based on changes in rust.

AndyGauge avatar Nov 29 '24 04:11 AndyGauge