-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `std`-matching methods of `RawEntryBuilder` only return `(&K, &V)`, but the index is also useful when working with `IndexMap`. ```rust impl<'a, K, V, S> RawEntryBuilder<'a, K, V, S> { /// Access an entry by hash, including its index. pub fn from_hash_full<F>(self, hash: u64, is_match: F) -> Option<(usize, &'a K, &'a V)> where F: FnMut(&K) -> bool, /// Access the index of an entry by hash. pub fn index_from_hash<F>(self, hash: u64, is_match: F) -> Option<usize> where F: FnMut(&K) -> bool, } ``` In addition, the `RawEntryMut` enum can report its index by forwarding to the existing methods on its variants. ```rust impl<'a, K, V, S> RawEntryMut<'a, K, V, S> { /// Return the index where the key-value pair exists or may be inserted. pub fn index(&self) -> usize } ```
- Loading branch information
Showing
1 changed file
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters