Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTree: fix documentation of unstable public members #81434

Merged
merged 1 commit into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,21 +1117,23 @@ impl<K: Ord, V> BTreeMap<K, V> {
right
}

/// Creates an iterator which 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.
///
/// Note that `drain_filter` lets you mutate every value in the filter closure, regardless of
/// whether you choose to keep or remove it.
///
/// If the iterator is only partially consumed or not consumed at all, each of the remaining
/// elements will still be subjected to the closure and removed and dropped if it returns true.
///
/// 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.
/// 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.
///
/// The iterator also lets you mutate the value of each element in the
/// closure, regardless of whether you choose to keep or remove it.
///
/// If the iterator is only partially consumed or not consumed at all, each
/// 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.
///
/// 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
///
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::BTreeSet;
///
/// let mut map = BTreeSet::new();
/// assert_eq!(map.first(), None);
/// assert_eq!(map.last(), None);
/// map.insert(1);
/// assert_eq!(map.last(), Some(&1));
/// map.insert(2);
Expand Down