-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Rename OnceCell methods to be more consistent with std conventions #78943
Conversation
For
|
Hm, I guess than it makes sense to use get_or_insert_with
try_get_or_insert_with for OnceCell? The benefit is that it exactly matches the The drawback is that it is long -- that's OK for Option, as it is one of it's rarely used methods. For OnceCell, however, that's the main API... |
I was just coming to say the same thing 🙂 I don’t personally think |
50d29ac
to
394eb1b
Compare
rerenamed! |
So would a future |
Yup, I think we can have |
CI fails because, apparently, one does not simply deprecate unstable std API. I'll remove the commit than... |
394eb1b
to
cf15e71
Compare
I think |
No need to make life of folks using nightly harder! We'll remove deprecated functions later, once everyone has a chance to migrate.
A by-value get-or-init API doesn’t seem very useful for these, have you ever come across use-cases that would want one? I think the I also didn’t think we needed to be consistent with |
Actually... Thinking about it you might want something like that if each caller might initialize with a different value. In that case you’re not worried about expensive initialization, but who got in first. |
Ok, it seems there's no quick consensus here... Let me register this as an unresolved question in the tracking issue. |
WDYT?
r? @ghost