diff options
| author | Stein Somers <git@steinsomers.be> | 2020-09-27 01:10:30 +0200 |
|---|---|---|
| committer | Stein Somers <git@steinsomers.be> | 2020-10-02 13:13:28 +0200 |
| commit | 90c8b43bc3cb867715bd08d93c3bb6e06819c3b1 (patch) | |
| tree | ae2998452de94b4cc58dc52d395f178f1da493b2 | |
| parent | fc42fb8e70af6ad63998f4bfbf62451551eda073 (diff) | |
| download | rust-90c8b43bc3cb867715bd08d93c3bb6e06819c3b1.tar.gz rust-90c8b43bc3cb867715bd08d93c3bb6e06819c3b1.zip | |
BTreeMap: document DrainFilterInner better
| -rw-r--r-- | library/alloc/src/collections/btree/map.rs | 8 |
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 3fb03a5412e..ee0f525fb15 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -1666,10 +1666,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>>, } |
