You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing ownership of the key to the entry() function can be costly. Especially if then 'common' case is that an element is found this enforces cloning the key for every lookup.
What I would like is to propose a version of the entry function (so far I've not come up with a good name) that takes a a borrowed key and enforces that the ToOwned trait exists. This way the underlying structure can clone/own the key only when required.
I'm happy to make a PR for this but I wanted to discuss the option first to ensure there is interest, make sure that I didn't overlook something blocking, and to find a good and useful name.
The text was updated successfully, but these errors were encountered:
👍 solves what I was trying to do :D glad there is such a nice API :) I ported it to halfbrown too! Closing since with raw_entry there is really no need for an entry API w/ ref's/borrowed values. Thanks for pointing me in the right direction!
Passing ownership of the key to the
entry()
function can be costly. Especially if then 'common' case is that an element is found this enforces cloning the key for every lookup.What I would like is to propose a version of the entry function (so far I've not come up with a good name) that takes a a borrowed key and enforces that the ToOwned trait exists. This way the underlying structure can clone/own the key only when required.
I'm happy to make a PR for this but I wanted to discuss the option first to ensure there is interest, make sure that I didn't overlook something blocking, and to find a good and useful name.
The text was updated successfully, but these errors were encountered: