Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinearMap entry API #471

Open
Ten0 opened this issue May 16, 2024 · 0 comments
Open

LinearMap entry API #471

Ten0 opened this issue May 16, 2024 · 0 comments

Comments

@Ten0
Copy link

Ten0 commented May 16, 2024

Currently to insert in the LinearMap and get a mutable reference to the corresponding value (map.entry(key).or_insert_with(...)), it's necessary to .insert() then .get().unwrap(), because there is no entry API or assimilated.

This implies:

  • Cloning the key, in order to be able to call get()
  • Iterating on the map twice: once to realize the entry is not there, and once to get the inserted entry

There was already an issue for entry APIs for maps: #103, but that was closed after only implementing it for only one of the map types: #289 - I would tend to believe that this was not intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants