-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Description
Location
https://doc.rust-lang.org/std/sync/struct.LazyLock.html
https://doc.rust-lang.org/std/sync/struct.OnceLock.html
https://doc.rust-lang.org/std/cell/struct.OnceCell.html
https://doc.rust-lang.org/std/cell/struct.LazyCell.html
Summary
Today I realized these are separate types. I used the experimental LazyLock before without realizing I can actually use stable OnceLock. These types are so similar that I never realized there are two of them.
Still, I don't think I quite understand the difference and the tradeoff (e.g. is some of them faster or not?). It would be useful if the docs pages linked to each other and explained the difference.