Open jethrogb opened 7 years ago
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.
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.
lazy_static
and std'sthread_local
are very similar concepts, butlazy_static
s interface (withDeref
) is much nicer. I think it should be possible to implement a thread-local version oflazy_static
.