Skip to main content

NodeFolder

Trait NodeFolder 

Source
pub trait NodeFolder {
    type NodeTy: Node;
    type Result;

    // Required method
    fn visit_up(
        &mut self,
        _node: Self::NodeTy,
        _children: Vec<Self::Result>,
    ) -> VortexResult<FoldUp<Self::Result>>;

    // Provided method
    fn visit_down(
        &mut self,
        _node: &Self::NodeTy,
    ) -> VortexResult<FoldDown<Self::Result>> { ... }
}
Expand description

This trait is used to implement a fold (see NodeFolderContext), but without a context.

Required Associated Types§

Required Methods§

Source

fn visit_up( &mut self, _node: Self::NodeTy, _children: Vec<Self::Result>, ) -> VortexResult<FoldUp<Self::Result>>

visit_up is called when a node is last encountered, in a pre-order traversal. If the node should stop traversal, return Stop. Otherwise, return Continue.

Provided Methods§

Source

fn visit_down( &mut self, _node: &Self::NodeTy, ) -> VortexResult<FoldDown<Self::Result>>

visit_down is called when a node is first encountered, in a pre-order traversal. If the node’s children are to be skipped, return Skip. If the node should stop traversal, return Stop. Otherwise, return Continue.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§