diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index 29e9423bb43..5481b327d69 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -2543,6 +2543,8 @@ pub const fn is_empty(&self) -> bool { /// a.insert(2, "b"); /// a.insert(3, "c"); /// a.insert(4, "c"); + /// let cursor = a.lower_bound(Bound::Included(&2)); + /// assert_eq!(cursor.key(), Some(&2)); /// let cursor = a.lower_bound(Bound::Excluded(&2)); /// assert_eq!(cursor.key(), Some(&3)); /// ``` @@ -2582,6 +2584,8 @@ pub fn lower_bound(&self, bound: Bound<&Q>) -> Cursor<'_, K, V> /// a.insert(2, "b"); /// a.insert(3, "c"); /// a.insert(4, "c"); + /// let cursor = a.lower_bound_mut(Bound::Included(&2)); + /// assert_eq!(cursor.key(), Some(&2)); /// let cursor = a.lower_bound_mut(Bound::Excluded(&2)); /// assert_eq!(cursor.key(), Some(&3)); /// ``` @@ -2634,6 +2638,8 @@ pub fn lower_bound_mut(&mut self, bound: Bound<&Q>) -> CursorMut<'_, K, V, A> /// a.insert(2, "b"); /// a.insert(3, "c"); /// a.insert(4, "c"); + /// let cursor = a.upper_bound(Bound::Included(&3)); + /// assert_eq!(cursor.key(), Some(&3)); /// let cursor = a.upper_bound(Bound::Excluded(&3)); /// assert_eq!(cursor.key(), Some(&2)); /// ``` @@ -2673,6 +2679,8 @@ pub fn upper_bound(&self, bound: Bound<&Q>) -> Cursor<'_, K, V> /// a.insert(2, "b"); /// a.insert(3, "c"); /// a.insert(4, "c"); + /// let cursor = a.upper_bound_mut(Bound::Included(&3)); + /// assert_eq!(cursor.key(), Some(&3)); /// let cursor = a.upper_bound_mut(Bound::Excluded(&3)); /// assert_eq!(cursor.key(), Some(&2)); /// ```