Skip to content

Commit f6f89dc

Browse files
committed
BTree(Set|Map): Guarantee that IntoIter will iterate in sorted by key order
1 parent 6e1f7b5 commit f6f89dc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

library/alloc/src/collections/btree/map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<'a, K: 'a, V: 'a> Default for IterMut<'a, K, V> {
415415
}
416416
}
417417

418-
/// An owning iterator over the entries of a `BTreeMap`.
418+
/// An owning iterator over the entries of a `BTreeMap`, sorted by key.
419419
///
420420
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`]
421421
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
@@ -1632,6 +1632,7 @@ impl<'a, K, V> IterMut<'a, K, V> {
16321632
}
16331633
}
16341634

1635+
/// Gets an owning iterator over the entries of the map, sorted by key.
16351636
#[stable(feature = "rust1", since = "1.0.0")]
16361637
impl<K, V, A: Allocator + Clone> IntoIterator for BTreeMap<K, V, A> {
16371638
type Item = (K, V);

library/alloc/src/collections/btree/set.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
140140
}
141141
}
142142

143-
/// An owning iterator over the items of a `BTreeSet`.
143+
/// An owning iterator over the items of a `BTreeSet` in ascending order.
144144
///
145145
/// This `struct` is created by the [`into_iter`] method on [`BTreeSet`]
146146
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
@@ -1232,6 +1232,7 @@ impl<T: Ord, const N: usize> From<[T; N]> for BTreeSet<T> {
12321232
}
12331233
}
12341234

1235+
/// Gets an owning iterator over the elements of the `BTreeSet` in ascending order.
12351236
#[stable(feature = "rust1", since = "1.0.0")]
12361237
impl<T, A: Allocator + Clone> IntoIterator for BTreeSet<T, A> {
12371238
type Item = T;

0 commit comments

Comments
 (0)