Skip to content

Commit e603553

Browse files
authored
Merge pull request #120 from bluss/get-index-of
Rename entry_index to get_index_of
2 parents f2142d9 + 1b54c5e commit e603553

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: src/map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1023,16 +1023,16 @@ where
10231023
where
10241024
Q: Hash + Equivalent<K>,
10251025
{
1026-
if let Some((_, found)) = self.find(key) {
1026+
if let Some(found) = self.get_index_of(key) {
10271027
let entry = &self.core.entries[found];
10281028
Some((found, &entry.key, &entry.value))
10291029
} else {
10301030
None
10311031
}
10321032
}
10331033

1034-
/// Return item index
1035-
pub fn entry_index<Q: ?Sized>(&self, key: &Q) -> Option<usize>
1034+
/// Return item index, if it exists in the map
1035+
pub fn get_index_of<Q: ?Sized>(&self, key: &Q) -> Option<usize>
10361036
where
10371037
Q: Hash + Equivalent<K>,
10381038
{

Diff for: src/set.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ where
327327
self.map.get_full(value).map(|(i, x, &())| (i, x))
328328
}
329329

330-
/// Return item index
331-
pub fn entry_index<Q: ?Sized>(&self, value: &Q) -> Option<usize>
330+
/// Return item index, if it exists in the set
331+
pub fn get_index_of<Q: ?Sized>(&self, value: &Q) -> Option<usize>
332332
where
333333
Q: Hash + Equivalent<T>,
334334
{
335-
self.map.entry_index(value)
335+
self.map.get_index_of(value)
336336
}
337337

338338
/// Adds a value to the set, replacing the existing value, if any, that is

0 commit comments

Comments
 (0)