Skip to content

Commit 25d0650

Browse files
authored
Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeMap: document DrainFilterInner better r? @Mark-Simulacrum
2 parents 830d1a0 + 90c8b43 commit 25d0650

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
@@ -1701,10 +1701,14 @@ where
17011701
/// Most of the implementation of DrainFilter, independent of the type
17021702
/// of the predicate, thus also serving for BTreeSet::DrainFilter.
17031703
pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> {
1704+
/// Reference to the length field in the borrowed map, updated live.
17041705
length: &'a mut usize,
1705-
// dormant_root is wrapped in an Option to be able to `take` it.
1706+
/// Burried reference to the root field in the borrowed map.
1707+
/// Wrapped in `Option` to allow drop handler to `take` it.
17061708
dormant_root: Option<DormantMutRef<'a, node::Root<K, V>>>,
1707-
// cur_leaf_edge is wrapped in an Option because maps without root lack a leaf edge.
1709+
/// Contains a leaf edge preceding the next element to be returned, or the last leaf edge.
1710+
/// Empty if the map has no root, if iteration went beyond the last leaf edge,
1711+
/// or if a panic occurred in the predicate.
17081712
cur_leaf_edge: Option<Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>>,
17091713
}
17101714

0 commit comments

Comments
 (0)