Closed bobi6666 closed 1 year ago
What would be the signature of this method?
i think fn get_unchecked_mut
2023-01-15 16:32 GMT+01:00, Alex Kladov @.***>:
What would be the signature of this method?
-- Reply to this email directly or view it on GitHub: https://github.com/matklad/once_cell/issues/216#issuecomment-1383181097 You are receiving this because you authored the thread.
Message ID: @.***>
yes but get_unchecked is lot faster when i using that when i am sure my cell is initialized and for this reason get_unchecked_mut would be also faster. normal get is slower when you are not sure if you initialized or not
2023-01-15 19:28 GMT+01:00, John Nunley @.***>:
There is already a
get_mut
method that I think does what you want-- Reply to this email directly or view it on GitHub: https://github.com/matklad/once_cell/issues/216#issuecomment-1383219473 You are receiving this because you authored the thread.
Message ID: @.***>
You can use get_mut().unwrap_unchecked()
. Though, I would encourage to verify via benchmarks that that’s indeed faster for your use case.
hello is there any steps how you can add get_unchecked_mut()? it can be used for example with rand crate on my side