when removing items from HashTrieMap and RedBlackTreeMap, if you want an owned value you always have to clone. In theory you shouldn't have to clone in all cases, for example when using insert_mut then removing the same value, its possible the item is only owned by a single collection and therefore try_unwrap could be used to produce the owned value.
Even if there wasn't an efficient implementation right off the bat, even one that always clones would be a convenient quality of life feature, especially for working with RedBlackTreeMap as a priority queue.
when removing items from
HashTrieMap
andRedBlackTreeMap
, if you want an owned value you always have to clone. In theory you shouldn't have to clone in all cases, for example when usinginsert_mut
then removing the same value, its possible the item is only owned by a single collection and thereforetry_unwrap
could be used to produce the owned value.Even if there wasn't an efficient implementation right off the bat, even one that always clones would be a convenient quality of life feature, especially for working with
RedBlackTreeMap
as a priority queue.I propose the following methods: