BTreeMap: fix documentation of unstable public members

This commit is contained in:
Stein Somers 2021-01-27 13:21:02 +01:00
parent 5605b5d693
commit f0b8166870
2 changed files with 15 additions and 13 deletions

View File

@ -1117,21 +1117,23 @@ impl<K: Ord, V> BTreeMap<K, V> {
right right
} }
/// Creates an iterator which uses a closure to determine if an element should be removed. /// Creates an iterator that visits all elements (key-value pairs) in
/// ascending key order and uses a closure to determine if an element should
/// be removed. If the closure returns `true`, the element is removed from
/// the map and yielded. If the closure returns `false`, or panics, the
/// element remains in the map and will not be yielded.
/// ///
/// If the closure returns true, the element is removed from the map and yielded. /// The iterator also lets you mutate the value of each element in the
/// If the closure returns false, or panics, the element remains in the map and will not be /// closure, regardless of whether you choose to keep or remove it.
/// yielded.
/// ///
/// Note that `drain_filter` lets you mutate every value in the filter closure, regardless of /// If the iterator is only partially consumed or not consumed at all, each
/// whether you choose to keep or remove it. /// of the remaining elements is still subjected to the closure, which may
/// change its value and, by returning `true`, have the element removed and
/// dropped.
/// ///
/// If the iterator is only partially consumed or not consumed at all, each of the remaining /// It is unspecified how many more elements will be subjected to the
/// elements will still be subjected to the closure and removed and dropped if it returns true. /// closure if a panic occurs in the closure, or a panic occurs while
/// /// dropping an element, or if the `DrainFilter` value is leaked.
/// It is unspecified how many more elements will be subjected to the closure
/// if a panic occurs in the closure, or a panic occurs while dropping an element,
/// or if the `DrainFilter` value is leaked.
/// ///
/// # Examples /// # Examples
/// ///

View File

@ -652,7 +652,7 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::BTreeSet; /// use std::collections::BTreeSet;
/// ///
/// let mut map = BTreeSet::new(); /// let mut map = BTreeSet::new();
/// assert_eq!(map.first(), None); /// assert_eq!(map.last(), None);
/// map.insert(1); /// map.insert(1);
/// assert_eq!(map.last(), Some(&1)); /// assert_eq!(map.last(), Some(&1));
/// map.insert(2); /// map.insert(2);