-
Notifications
You must be signed in to change notification settings - Fork 160
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
Implement in place sorting of OrderMap and OrderSet #55
Comments
sort()
for OrderSet
sort()
for OrderSet
You could also use |
@clarcharr do you mean it could be named that? I suggested |
Sorry; to clarify, you could replace the code in the post with:
|
Oh, I didn't realize that |
I agree with this feature request. No comment on whether it is possible easily |
A side note about sort_by_key, is that the key version sometimes will need to clone the keys when the _by version does not. |
I have taken the liberty to edit the original post to better reflect what I think we are seeking. It's your post, so you are free to edit it too, it's a collaboration.. |
|
Implemented as an experiment in #57, (building upon the retain in place PR, so that one needs to merge first). Yes, instead of Vec's |
Fixed in #57 |
Feature request: Add in-place sorting methods to OrderMap (and OrderSet). Similar to the existing
.sorted_by
, these methods can allow the user to sort by either keys or values or both by supplying all of those to the closure.For example:
Original issue:
Feature request: add
sort_keys<K:Ord+Hash>(&mut self)
to do an inplace sort.This library is INCREDIBLE when assertions need to be made because I can do an inplace sort and the diffs look good (when combined with
pretty_assertions
of course).I did a naive implementation like this:
I'm sure a better one can be done with full access to the underlying data structure.
The text was updated successfully, but these errors were encountered: