Skip to content

Commit 01f3ef0

Browse files
committed
Make IndexMap::get_* docs more consistent
1 parent cd4c1a5 commit 01f3ef0

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/map.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ where
828828
self.get_index_of(key).is_some()
829829
}
830830

831-
/// Return a reference to the value stored for `key`, if it is present,
831+
/// Return a reference to the stored value for `key`, if it is present,
832832
/// else `None`.
833833
///
834834
/// Computes in **O(1)** time (average).
@@ -844,7 +844,7 @@ where
844844
}
845845
}
846846

847-
/// Return references to the key-value pair stored for `key`,
847+
/// Return references to the stored key-value pair for the lookup `key`,
848848
/// if it is present, else `None`.
849849
///
850850
/// Computes in **O(1)** time (average).
@@ -860,7 +860,10 @@ where
860860
}
861861
}
862862

863-
/// Return item index, key and value
863+
/// Return the index with references to the stored key-value pair for the
864+
/// lookup `key`, if it is present, else `None`.
865+
///
866+
/// Computes in **O(1)** time (average).
864867
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>
865868
where
866869
Q: ?Sized + Hash + Equivalent<K>,
@@ -873,7 +876,7 @@ where
873876
}
874877
}
875878

876-
/// Return item index, if it exists in the map
879+
/// Return the item index for `key`, if it is present, else `None`.
877880
///
878881
/// Computes in **O(1)** time (average).
879882
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
@@ -890,6 +893,10 @@ where
890893
}
891894
}
892895

896+
/// Return a mutable reference to the stored value for `key`,
897+
/// if it is present, else `None`.
898+
///
899+
/// Computes in **O(1)** time (average).
893900
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
894901
where
895902
Q: ?Sized + Hash + Equivalent<K>,
@@ -902,8 +909,8 @@ where
902909
}
903910
}
904911

905-
/// Return references to the key-value pair stored for `key`,
906-
/// if it is present, else `None`.
912+
/// Return a reference and mutable references to the stored key-value pair
913+
/// for the lookup `key`, if it is present, else `None`.
907914
///
908915
/// Computes in **O(1)** time (average).
909916
pub fn get_key_value_mut<Q>(&mut self, key: &Q) -> Option<(&K, &mut V)>
@@ -918,6 +925,10 @@ where
918925
}
919926
}
920927

928+
/// Return the index with a reference and mutable reference to the stored
929+
/// key-value pair for the lookup `key`, if it is present, else `None`.
930+
///
931+
/// Computes in **O(1)** time (average).
921932
pub fn get_full_mut<Q>(&mut self, key: &Q) -> Option<(usize, &K, &mut V)>
922933
where
923934
Q: ?Sized + Hash + Equivalent<K>,

0 commit comments

Comments
 (0)