struct TreeVisitorStack<NodeContinue, NodeApp, ErrHandler> {
initial: UniIndex,
f_continue: NodeContinue,
f_propagate: NodeApp,
err_builder: ErrHandler,
stack: Vec<(UniIndex, AccessRelatedness, RecursionState)>,
}
Expand description
Stack of nodes left to explore in a tree traversal.
See the docs of traverse_this_parents_children_other
for details on the
traversal order.
Fields§
§initial: UniIndex
Identifier of the original access.
f_continue: NodeContinue
Function describing whether to continue at a tag. This is only invoked for foreign accesses.
f_propagate: NodeApp
Function to apply to each tag.
err_builder: ErrHandler
Handler to add the required context to diagnostics.
stack: Vec<(UniIndex, AccessRelatedness, RecursionState)>
Mutable state of the visit: the tags left to handle. Every tag pushed should eventually be handled, and the precise order is relevant for diagnostics. Since the traversal is piecewise bottom-up, we need to remember whether we’re here initially, or after visiting all children. The last element indicates this. This is just an artifact of how you hand-roll recursion, it does not have a deeper meaning otherwise.
Implementations§
Source§impl<NodeContinue, NodeApp, InnErr, OutErr, ErrHandler> TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>where
NodeContinue: Fn(&NodeAppArgs<'_>) -> ContinueTraversal,
NodeApp: Fn(NodeAppArgs<'_>) -> Result<(), InnErr>,
ErrHandler: Fn(ErrHandlerArgs<'_, InnErr>) -> OutErr,
impl<NodeContinue, NodeApp, InnErr, OutErr, ErrHandler> TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>where
NodeContinue: Fn(&NodeAppArgs<'_>) -> ContinueTraversal,
NodeApp: Fn(NodeAppArgs<'_>) -> Result<(), InnErr>,
ErrHandler: Fn(ErrHandlerArgs<'_, InnErr>) -> OutErr,
fn should_continue_at( &self, this: &mut TreeVisitor<'_>, idx: UniIndex, rel_pos: AccessRelatedness, ) -> ContinueTraversal
fn propagate_at( &mut self, this: &mut TreeVisitor<'_>, idx: UniIndex, rel_pos: AccessRelatedness, ) -> Result<(), OutErr>
fn go_upwards_from_accessed( &mut self, this: &mut TreeVisitor<'_>, accessed_node: UniIndex, visit_children: ChildrenVisitMode, ) -> Result<(), OutErr>
fn finish_foreign_accesses( &mut self, this: &mut TreeVisitor<'_>, ) -> Result<(), OutErr>
fn new( initial: UniIndex, f_continue: NodeContinue, f_propagate: NodeApp, err_builder: ErrHandler, ) -> Self
Auto Trait Implementations§
impl<NodeContinue, NodeApp, ErrHandler> Freeze for TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>
impl<NodeContinue, NodeApp, ErrHandler> RefUnwindSafe for TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>
impl<NodeContinue, NodeApp, ErrHandler> Send for TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>
impl<NodeContinue, NodeApp, ErrHandler> Sync for TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>
impl<NodeContinue, NodeApp, ErrHandler> Unpin for TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>
impl<NodeContinue, NodeApp, ErrHandler> UnwindSafe for TreeVisitorStack<NodeContinue, NodeApp, ErrHandler>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.