-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
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.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.