diff options
| author | bors <bors@rust-lang.org> | 2023-07-30 07:57:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-30 07:57:13 +0000 |
| commit | 4c9ac1e93b43389890d0d77eeb479b79da62da25 (patch) | |
| tree | ea915fba6aefe68854e1f8fffe5507cf1d3e1888 /library/alloc | |
| parent | 2e0136a131f6ed5f6071adf36db08dd8d2205d19 (diff) | |
| parent | 7b4bfd640de7b5dda0898b54847dbc706f6fbe58 (diff) | |
| download | rust-4c9ac1e93b43389890d0d77eeb479b79da62da25.tar.gz rust-4c9ac1e93b43389890d0d77eeb479b79da62da25.zip | |
Auto merge of #114236 - fee1-dead-contrib:rollup-m92j7q1, r=fee1-dead
Rollup of 3 pull requests
Successful merges:
- #112151 (Clarify behavior of inclusive bounds in BTreeMap::{lower,upper}_bound)
- #113512 (Updated lines doc to include trailing carriage return note)
- #114203 (Effects: don't print `host` param in diagnostics)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/collections/btree/map.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { /// 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 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { /// 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 @@ impl<K, V, A: Allocator + Clone> BTreeMap<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 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { /// 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)); /// ``` |
