@@ -5,25 +5,22 @@ use super::tree_slice;
5
5
use super :: { Arc , Lnode , Node , Tree , TreeSlice } ;
6
6
7
7
/// An iterator over the units of a metric.
8
+ //
9
+ // Just like the `Leaves` iterator, this iterator is also implemented using two
10
+ // separate iterators, one for iterating forward (used in the `Iterator` impl),
11
+ // and the other for iterating backward (used in the `DoubleEndedIterator`
12
+ // impl).
13
+ //
14
+ // These two iterators are completely independent and don't know about each
15
+ // other, which could cause them to overlap if alternating between calling
16
+ // `Units::next()` and `Units::next_back()`.
17
+ //
18
+ // To prevent this we also store the base measure of the unyielded iterating
19
+ // range, which is decreased as new `TreeSliece`s are yielded (both forward and
20
+ // backward). Once that reaches zero this iterator will stop yielding any more
21
+ // items.
8
22
#[ derive( Clone ) ]
9
23
pub struct Units < ' a , const ARITY : usize , L : Leaf , M : Metric < L :: Summary > > {
10
- /*
11
- Just like the `Leaves` iterator, this iterator is also implemented using
12
- two separate iterators, one for iterating forward (used in the `Iterator`
13
- impl), and the other for iterating backward (used in the
14
- `DoubleEndedIterator` impl).
15
-
16
- These two iterators are completely independent and don't know about each
17
- other, which could cause them to overlap if alternating between calling
18
- `Units::next()` and `Units::next_back()`.
19
-
20
- To prevent this we also store the base measure of the unyielded iterating
21
- range, which is decreased as new `TreeSliece`s are yielded (both forward
22
- and backward). Once that reaches zero this iterator will stop yielding
23
- any more items.
24
- */
25
- #[ rustfmt:: skip]
26
-
27
24
/// Iterates over the `M`-units from front to back.
28
25
forward : UnitsForward < ' a , ARITY , L , M > ,
29
26
0 commit comments