pub trait Node: Sized + Clone {
// Required methods
fn apply_children<'a, F: FnMut(&'a Self) -> VortexResult<TraversalOrder>>(
&'a self,
f: F,
) -> VortexResult<TraversalOrder>;
fn map_children<F: FnMut(Self) -> VortexResult<Transformed<Self>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>>;
// Provided methods
fn rewrite<R: NodeRewriter<NodeTy = Self>>(
self,
rewriter: &mut R,
) -> VortexResult<Transformed<Self>> { ... }
fn accept<'a, V: NodeVisitor<'a, NodeTy = Self>>(
&'a self,
visitor: &mut V,
) -> VortexResult<TraversalOrder> { ... }
fn transform_down<F: FnMut(Self) -> VortexResult<Transformed<Self>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>> { ... }
fn transform_up<F: FnMut(Self) -> VortexResult<Transformed<Self>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>> { ... }
}Required Methods§
Sourcefn apply_children<'a, F: FnMut(&'a Self) -> VortexResult<TraversalOrder>>(
&'a self,
f: F,
) -> VortexResult<TraversalOrder>
fn apply_children<'a, F: FnMut(&'a Self) -> VortexResult<TraversalOrder>>( &'a self, f: F, ) -> VortexResult<TraversalOrder>
Walk the node’s children by applying f to them.
This is a lower level API that other functions rely on for correctness.
Sourcefn map_children<F: FnMut(Self) -> VortexResult<Transformed<Self>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>>
fn map_children<F: FnMut(Self) -> VortexResult<Transformed<Self>>>( self, f: F, ) -> VortexResult<Transformed<Self>>
Rewrite the node’s children by applying f to them.
This is a lower level API that other functions rely on for correctness.
Provided Methods§
Sourcefn rewrite<R: NodeRewriter<NodeTy = Self>>(
self,
rewriter: &mut R,
) -> VortexResult<Transformed<Self>>
fn rewrite<R: NodeRewriter<NodeTy = Self>>( self, rewriter: &mut R, ) -> VortexResult<Transformed<Self>>
Walk the tree in pre-order (top-down) way, rewriting it as it goes.
Sourcefn accept<'a, V: NodeVisitor<'a, NodeTy = Self>>(
&'a self,
visitor: &mut V,
) -> VortexResult<TraversalOrder>
fn accept<'a, V: NodeVisitor<'a, NodeTy = Self>>( &'a self, visitor: &mut V, ) -> VortexResult<TraversalOrder>
A pre-order (top-down) traversal.
Sourcefn transform_down<F: FnMut(Self) -> VortexResult<Transformed<Self>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>>
fn transform_down<F: FnMut(Self) -> VortexResult<Transformed<Self>>>( self, f: F, ) -> VortexResult<Transformed<Self>>
A pre-order transformation
Sourcefn transform_up<F: FnMut(Self) -> VortexResult<Transformed<Self>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>>
fn transform_up<F: FnMut(Self) -> VortexResult<Transformed<Self>>>( self, f: F, ) -> VortexResult<Transformed<Self>>
A post-order transform
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.