lazy-static.rs icon indicating copy to clipboard operation
lazy-static.rs copied to clipboard

Thread-local lazy static

Open jethrogb opened this issue 8 years ago • 2 comments

lazy_static and std's thread_local are very similar concepts, but lazy_statics interface (with Deref) is much nicer. I think it should be possible to implement a thread-local version of lazy_static.

jethrogb avatar Jul 21 '17 15:07 jethrogb

Indeed, some consistency between the two would be nice. I've always thought of that more as changing lazy_statics API to be closer to thread_local, but providing a wrapper for it with a nicer API seems like a interesting idea as well.

Kimundi avatar Nov 08 '17 11:11 Kimundi

I've made a crate that combined lazy_static, thread_local and RefCell. https://crates.io/crates/ref_thread_local

Do modification on lazy_static directly needs near fully rewrite so I create a new repository.

tuxzz avatar Oct 01 '18 16:10 tuxzz