3 ms·
There are scenarios where retrieving the just-inserted value without first cloning it isn't possible. E.g.: when inserting a value into a non-empty hashset and
by jiggawatts 1y ago
There are scenarios where retrieving the just-inserted value without first cloning it isn't possible. E.g.: when inserting a value into a non-empty hashset and then needing it again immediately.
But yeah... that's a bit of a contrived example and can be solved by a simple change to the insert function without specialised support from the language.
- estebank 1y agoIt sounds like you'd want the entry API: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.entry https://doc.rust-lang.org/std/collections/struct.HashMap.htm...