add a take method which takes a mutable reference#100
Conversation
c705ac2 to
603162d
Compare
|
Hm, I am a bit on the fence about this... My first reaction is that What do you think about renaming |
|
Sure, sounds reasonable to me for symmetry. |
I use `OnceCell` extensively in my code to cache lazily computed data on structs. Sometimes, I mutate the data -- in which case I have to invalidate those caches. This is of course possible to do by oneself, but it's slightly non-obvious that the "once" bit of OnceCell only applies in the shared reference context.
reset method which takes a mutable referencetake method which takes a mutable reference
|
done, thanks! |
|
ah, looks like |
|
I'd prefer not to bump MSRV unless necessary (really, I'd prefer to not bump MSRV at all, and just implement rust-lang/rfcs#2788). |
|
I'll fix this up myself, thanks for sending a PR and sorry for this taking so long to review :) |
|
Also, wow, this is the hundredth issue/pr... Didn't expect that from a relatively simple utility crate :) |
|
Published as 1.4.0: https://crates.io/crates/once_cell/1.4.0 |
I use
OnceCellextensively in my code to cache lazily computed data onstructs. Sometimes, I mutate the data -- in which case I have to invalidate
those caches.
This is of course possible to do by oneself, but it's slightly non-obvious
that the "once" bit of OnceCell only applies in the shared reference context.