ok cool the hash_map::Entry interface lets you insert things into a hashmap and return a ref to them, which HashMap::insert() does not allow since it takes ownership of the key and value
The point being you can't get a reference to the new element with insert since it takes ownership of the key. You'd have to clone the key to get the reference that you just inserted
-
-
what?
-
map.insert(key, value) map.get(&key).unwrap()
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.