feat: Add equivalent trait support for flexible key lookups #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for the
Equivalenttrait to enable flexible key lookups in bothPriorityQueueandDoublePriorityQueue.Background
The underlying IndexMap uses the
Equivalenttrait as the boundary for input types in lookup operations. This PR updates the trait bounds for priority queue APIs to align with this requirement, replacing the previousBorrow<Q>pattern.Changes
get_priority,contains,change_priority,get,get_mut,remove) to useEquivalent<I>trait boundsBackward Compatibility
This change maintains full backward compatibility. Existing code that satisfied the previous trait bound:
continues to work without modification thanks to the blanket implementation provided by the equivalent crate. Users can now implement custom
Equivalenttraits for flexible key lookups.