diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-01-23 09:38:44 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2016-01-23 09:38:44 -0500 |
| commit | b0b1df84254fb6b6fc9eb11cceea8441c6cf596d (patch) | |
| tree | b1941b55072e45844cee8a6f7281d7394d8ec2f3 | |
| parent | 9e5c8aa23f500818e56a90c5a617b697edf55fce (diff) | |
| parent | f81a11b7b87cea6fcf7a4d85bdeedfd1725a47f8 (diff) | |
| download | rust-b0b1df84254fb6b6fc9eb11cceea8441c6cf596d.tar.gz rust-b0b1df84254fb6b6fc9eb11cceea8441c6cf596d.zip | |
Rollup merge of #31136 - mbrubeck:btree-doc, r=steveklabnik
Also change the examples to make this more obvious. Fixes #31129.
| -rw-r--r-- | src/libcollections/btree/map.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 492263da2bc..0ced4e1952a 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1194,7 +1194,7 @@ unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T { } impl<K, V> BTreeMap<K, V> { - /// Gets an iterator over the entries of the map. + /// Gets an iterator over the entries of the map, sorted by key. /// /// # Examples /// @@ -1202,9 +1202,9 @@ impl<K, V> BTreeMap<K, V> { /// use std::collections::BTreeMap; /// /// let mut map = BTreeMap::new(); - /// map.insert(1, "a"); - /// map.insert(2, "b"); /// map.insert(3, "c"); + /// map.insert(2, "b"); + /// map.insert(1, "a"); /// /// for (key, value) in map.iter() { /// println!("{}: {}", key, value); @@ -1224,7 +1224,7 @@ impl<K, V> BTreeMap<K, V> { } } - /// Gets a mutable iterator over the entries of the map. + /// Gets a mutable iterator over the entries of the map, sorted by key. /// /// # Examples /// @@ -1257,7 +1257,7 @@ impl<K, V> BTreeMap<K, V> { } } - /// Gets an iterator over the keys of the map. + /// Gets an iterator over the keys of the map, in sorted order. /// /// # Examples /// @@ -1265,8 +1265,8 @@ impl<K, V> BTreeMap<K, V> { /// use std::collections::BTreeMap; /// /// let mut a = BTreeMap::new(); - /// a.insert(1, "a"); /// a.insert(2, "b"); + /// a.insert(1, "a"); /// /// let keys: Vec<_> = a.keys().cloned().collect(); /// assert_eq!(keys, [1, 2]); @@ -1276,7 +1276,7 @@ impl<K, V> BTreeMap<K, V> { Keys { inner: self.iter() } } - /// Gets an iterator over the values of the map. + /// Gets an iterator over the values of the map, in order by key. /// /// # Examples /// @@ -1284,11 +1284,11 @@ impl<K, V> BTreeMap<K, V> { /// use std::collections::BTreeMap; /// /// let mut a = BTreeMap::new(); - /// a.insert(1, "a"); - /// a.insert(2, "b"); + /// a.insert(1, "hello"); + /// a.insert(2, "goodbye"); /// /// let values: Vec<&str> = a.values().cloned().collect(); - /// assert_eq!(values, ["a", "b"]); + /// assert_eq!(values, ["hello", "goodbye"]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn values<'a>(&'a self) -> Values<'a, K, V> { |
