-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add get_mut() to maps #52
Conversation
09da45f
to
e8bed47
Compare
Codecov Report
@@ Coverage Diff @@
## master #52 +/- ##
==========================================
- Coverage 93.24% 92.83% -0.41%
==========================================
Files 11 11
Lines 1583 1620 +37
==========================================
+ Hits 1476 1504 +28
- Misses 107 116 +9
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for you contribution. I just have a small comment and it should be good to go.
Bucket::Single(_) => None, | ||
Bucket::Collision(entries) => { | ||
let removed = | ||
bucket_utils::list_remove_first(entries, |e| e.matches(key, key_hash)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this more efficiently, but I don't think we care, given that collisions are extremely rare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it shouldn't matter in practice. I thought about doing it the "right way" but it would change a lot more code due to the limited api for the list. Doing this way I got away with just "first_mut".
With it the user can avoid the clunky pattern get() + modify + insert().
Merged. Thanks. |
I was hoping you could make a new release? That will include the rand 0.8 update and the get_mut. Thank you 🙏 |
Sure. Released v0.9.0. |
With it the user can avoid the clunky pattern get() + clone + modify + insert(). Especially useful if you have early returns (eg. with
?
) in between.