ystero-dev / scalpel

Packet Dissection and sculpting in Rust
Other
3 stars 6 forks source link

Support `OnceCell` and remove `lazy_static` #42

Closed gabhijit closed 6 months ago

gabhijit commented 6 months ago

Functionality provided by lazy_static is now available as a part of core and std as OnceCell. This can be used in places where we are using lazy_static.

gabhijit commented 6 months ago

@csking101 : Do you want to take up this?

csking101 commented 6 months ago

Yup, I'll look into it.

csking101 commented 6 months ago

Hi sir, after looking into OnceCell, I came across a few things that I wanted to discuss.

gabhijit commented 6 months ago

Yes, OnceCell is not thread safe, instead you can look into OnceLock. The semantics are a bit different. Let's try to review the approach first by making one or two small changes and then let's see what makes sense.

Yes LazyCell will be available only on nightly and that will be kind of limiting, in that case we can continue to work with lazy_cell as it is.

So let's try and work with OnceLock first and then determine whether to take that approach further.

Makes Sense?

gabhijit commented 6 months ago

Fixed by #52