-
Notifications
You must be signed in to change notification settings - Fork 4
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 values to Augmentation functions #35
Conversation
#24 ref |
Hmm, but key removal and reinsertion might require rebalancing twice (I did not prove this, but I believe it is true). Perhaps I am simply wanting too specific of a behavior from a general data structure while maintaining all of its advantages. |
Just tweaked the Augmentation trait, and pass in the values reference. The code indead looks much cleaner. |
|
Hey thanks for doing this! I suppose that implementing key only augmentations will be optimized by the compiler. Did you compare any benchmarks to make sure you're not losing out on perf? |
Noop, I did not do any benchmark yet. I believe the compiler should kick in and optimize it, but that's hard to say... It would be great to define a new set of benchmark for augmentation features. Before doing that, do you think the implementation suits your use case? |
It looks to me like the So is your plan to document that values can be used, but that implementors of |
Yup. I think the use case is common and the likelihood of both "get_mut and update" + "Augmentation based on Value" is low. |
I think so as well, and at least it would only be a logic error, similar to mutating key in-place in a |
This is a rough workable version to handle duplicate values with "Upsert" approach.