提交 6eefee10 编写于 作者: C ccQpein

Add doctests for 's into_values and into_keys methods

上级 5fb3394c
......@@ -971,7 +971,11 @@ pub fn retain<F>(&mut self, f: F)
/// map.insert("b", 2);
/// map.insert("c", 3);
///
/// let vec: Vec<&str> = map.into_keys().collect();
/// let mut vec: Vec<&str> = map.into_keys().collect();
/// // The `IntoKeys` iterator produces keys in arbitrary order, so the
/// // keys must be sorted to test them against a sorted array.
/// vec.sort_unstable();
/// assert_eq!(vec, ["a", "b", "c"]);
/// ```
#[inline]
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
......@@ -993,7 +997,11 @@ pub fn into_keys(self) -> IntoKeys<K, V> {
/// map.insert("b", 2);
/// map.insert("c", 3);
///
/// let vec: Vec<i32> = map.into_values().collect();
/// let mut vec: Vec<i32> = map.into_values().collect();
/// // The `IntoValues` iterator produces values in arbitrary order, so
/// // the values must be sorted to test them against a sorted array.
/// vec.sort_unstable();
/// assert_eq!(vec, [1, 2, 3]);
/// ```
#[inline]
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册