-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation for Once
to reference std::sync::OnceLock
.
#159
base: master
Are you sure you want to change the base?
Conversation
ff94aac
to
c43251e
Compare
c43251e
to
f8407dd
Compare
/// Unlike its `std::sync` equivalent, this is generalized such that the closure returns a | ||
/// value to be stored by the [`Once`] (`std::sync::Once` can be trivially emulated with | ||
/// `Once`). | ||
/// This is analogous to `std::sync::OnceLock`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think this is probably too strong a statement. They're definitely very similar, but the APIs differ enough that I'd probably go for something like:
This type has similar behaviour to `std::sync::OnceLock`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous "equivalent" was already much stronger language than "analogous," which isn't any stronger of a statement than "similar behavio[u]r." For most people, if they need a spinlock variant of std::sync::OnceLock
then they'll consider spin::Once
.
//! - [`Once`] owns the value returned by its `call_once` initializer. | ||
//! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for removing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, we were comparing spin::Once
to std::sync::Once
, which didn't own the result of the initializer. Now we're comparing it to OnceLock
, which does own the result of the initializer.
Apologies for not finishing off this review earlier, I've had a lot on this week. I should be in a position to finish this off tomorrow. |
The same updates could probably be applied to |
No description provided.