about summary refs log tree commit diff
path: root/library/alloc
diff options
context:
space:
mode:
authorultrabear <bearodark@gmail.com>2024-03-21 00:54:50 -0700
committerultrabear <bearodark@gmail.com>2024-03-21 00:54:50 -0700
commitf6f89dc2023315b777f0ffef3b4c4573d364beb8 (patch)
tree4e3f38c07b8e555a98ba11764d1cf7a180c8eff7 /library/alloc
parent6e1f7b538a1d6fc6208b1821139148a8d6dc6560 (diff)
downloadrust-f6f89dc2023315b777f0ffef3b4c4573d364beb8.tar.gz
rust-f6f89dc2023315b777f0ffef3b4c4573d364beb8.zip
BTree(Set|Map): Guarantee that `IntoIter` will iterate in sorted by key order
Diffstat (limited to 'library/alloc')
-rw-r--r--library/alloc/src/collections/btree/map.rs3
-rw-r--r--library/alloc/src/collections/btree/set.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index e99c6220e20..66b45f86601 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -415,7 +415,7 @@ impl<'a, K: 'a, V: 'a> Default for IterMut<'a, K, V> {
     }
 }
 
-/// An owning iterator over the entries of a `BTreeMap`.
+/// An owning iterator over the entries of a `BTreeMap`, sorted by key.
 ///
 /// This `struct` is created by the [`into_iter`] method on [`BTreeMap`]
 /// (provided by the [`IntoIterator`] trait). See its documentation for more.
@@ -1632,6 +1632,7 @@ impl<'a, K, V> IterMut<'a, K, V> {
     }
 }
 
+/// Gets an owning iterator over the entries of the map, sorted by key.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<K, V, A: Allocator + Clone> IntoIterator for BTreeMap<K, V, A> {
     type Item = (K, V);
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index ed91ae1a66e..9c0b89188d8 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -140,7 +140,7 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
     }
 }
 
-/// An owning iterator over the items of a `BTreeSet`.
+/// An owning iterator over the items of a `BTreeSet` in ascending order.
 ///
 /// This `struct` is created by the [`into_iter`] method on [`BTreeSet`]
 /// (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> {
     }
 }
 
+/// Gets an owning iterator over the elements of the `BTreeSet` in ascending order.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T, A: Allocator + Clone> IntoIterator for BTreeSet<T, A> {
     type Item = T;