pub struct SiblingCache<'tree>(/* private fields */);Expand description
The children of each wide node on a walk’s chain, recorded as the
walk pushes them, so that Ancestors::siblings_after and
Ancestors::siblings_before find a sibling in a flat ERROR, or
past a run of extras ahead of a list’s elements, without a scan from
its start (#1584, #1868).
One slot per depth, keyed by the node’s id. A walk descends into a node only after pushing its children, so every wide node on the chain has its slot; a slot left behind by a node the walk has moved past holds another id and is not read. Recording copies what the walk already holds, once per wide node.
A walk lends it through Ancestors::for_walk (#1601).
Implementations§
Source§impl<'tree> SiblingCache<'tree>
impl<'tree> SiblingCache<'tree>
Sourcepub fn record(
&mut self,
node: &Node<'tree>,
depth: usize,
children: impl IntoIterator<Item = Node<'tree>>,
)
pub fn record( &mut self, node: &Node<'tree>, depth: usize, children: impl IntoIterator<Item = Node<'tree>>, )
Records children, in order, as the children of node, which
sits at depth in the walk’s chain. A node of no more than a
short scan’s children is not recorded, and its batch is not read.
children is every child of node: a lookup indexes into the
record, so a batch that left one out would answer with the wrong
sibling. A debug build rejects a batch of any other length.