about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-04 11:45:04 +0900
committerGitHub <noreply@github.com>2020-10-04 11:45:04 +0900
commit25d0650d0fba54ec1971426b2be55e95f8a0655f (patch)
tree942609ec345d8ad2c456bedaa844f64d53fda1f0
parent830d1a0e32c7ad6d34e22e07d498f4f0eda6fb5b (diff)
parent90c8b43bc3cb867715bd08d93c3bb6e06819c3b1 (diff)
downloadrust-25d0650d0fba54ec1971426b2be55e95f8a0655f.tar.gz
rust-25d0650d0fba54ec1971426b2be55e95f8a0655f.zip
Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeMap: document DrainFilterInner better

r? @Mark-Simulacrum
-rw-r--r--library/alloc/src/collections/btree/map.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index 2b244a04d22..04f317401f1 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -1701,10 +1701,14 @@ where
 /// Most of the implementation of DrainFilter, independent of the type
 /// of the predicate, thus also serving for BTreeSet::DrainFilter.
 pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> {
+    /// Reference to the length field in the borrowed map, updated live.
     length: &'a mut usize,
-    // dormant_root is wrapped in an Option to be able to `take` it.
+    /// Burried reference to the root field in the borrowed map.
+    /// Wrapped in `Option` to allow drop handler to `take` it.
     dormant_root: Option<DormantMutRef<'a, node::Root<K, V>>>,
-    // cur_leaf_edge is wrapped in an Option because maps without root lack a leaf edge.
+    /// Contains a leaf edge preceding the next element to be returned, or the last leaf edge.
+    /// Empty if the map has no root, if iteration went beyond the last leaf edge,
+    /// or if a panic occurred in the predicate.
     cur_leaf_edge: Option<Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>>,
 }