File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1031,6 +1031,18 @@ where
1031
1031
}
1032
1032
}
1033
1033
1034
+ /// Return item index
1035
+ pub fn entry_index < Q : ?Sized > ( & self , key : & Q ) -> Option < usize >
1036
+ where
1037
+ Q : Hash + Equivalent < K > ,
1038
+ {
1039
+ if let Some ( ( _, found) ) = self . find ( key) {
1040
+ Some ( found)
1041
+ } else {
1042
+ None
1043
+ }
1044
+ }
1045
+
1034
1046
pub fn get_mut < Q : ?Sized > ( & mut self , key : & Q ) -> Option < & mut V >
1035
1047
where
1036
1048
Q : Hash + Equivalent < K > ,
Original file line number Diff line number Diff line change @@ -327,6 +327,14 @@ where
327
327
self . map . get_full ( value) . map ( |( i, x, & ( ) ) | ( i, x) )
328
328
}
329
329
330
+ /// Return item index
331
+ pub fn entry_index < Q : ?Sized > ( & self , value : & Q ) -> Option < ( usize ) >
332
+ where
333
+ Q : Hash + Equivalent < T > ,
334
+ {
335
+ self . map . entry_index ( value)
336
+ }
337
+
330
338
/// Adds a value to the set, replacing the existing value, if any, that is
331
339
/// equal to the given one. Returns the replaced value.
332
340
///
You can’t perform that action at this time.
0 commit comments