Skip to content

Commit 90c8b43

Browse files
committed
BTreeMap: document DrainFilterInner better
1 parent fc42fb8 commit 90c8b43

File tree

1 file changed

+6
-2
lines changed
  • library/alloc/src/collections/btree

1 file changed

+6
-2
lines changed

library/alloc/src/collections/btree/map.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1666,10 +1666,14 @@ where
16661666
/// Most of the implementation of DrainFilter, independent of the type
16671667
/// of the predicate, thus also serving for BTreeSet::DrainFilter.
16681668
pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> {
1669+
/// Reference to the length field in the borrowed map, updated live.
16691670
length: &'a mut usize,
1670-
// dormant_root is wrapped in an Option to be able to `take` it.
1671+
/// Burried reference to the root field in the borrowed map.
1672+
/// Wrapped in `Option` to allow drop handler to `take` it.
16711673
dormant_root: Option<DormantMutRef<'a, node::Root<K, V>>>,
1672-
// cur_leaf_edge is wrapped in an Option because maps without root lack a leaf edge.
1674+
/// Contains a leaf edge preceding the next element to be returned, or the last leaf edge.
1675+
/// Empty if the map has no root, if iteration went beyond the last leaf edge,
1676+
/// or if a panic occurred in the predicate.
16731677
cur_leaf_edge: Option<Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>>,
16741678
}
16751679

0 commit comments

Comments
 (0)