Closed digama0 closed 2 years ago
I think a rebuild mechanism would be useful, but it would have a different type signature; I considered making the core of this algorithm more like an iterator, with a OutlineBuilder
containing the local variables in this loop. Presumably that is the data structure you would want to have an append method on. Outline
in some sense loses information since it closes off the nodes at the end of the file, making them unsuitable for later appends. (I didn't check whether tree nodes are immutable once created, but the code seems to be written as if they are so I went with that. If you allow the tree nodes themselves to be modified, you could append directly to an Outline
by pushing to the appropriate node along the right spine of the tree.)
Outline
no longer implementsDefault
. (The default value was not a valid outline, because theroot
index was out of bounds of the tree.)build_outline()
now returns theOutline
instead of modifying the default value.build_outline
has been refactored:unwrap
s neededsibling_stack
instead of a vector-of-vectors for fewer allocations