pub trait NodeContainer<'a, T: 'a>: Sized {
// Required methods
fn apply_elements<F: FnMut(&'a T) -> VortexResult<TraversalOrder>>(
&'a self,
f: F,
) -> VortexResult<TraversalOrder>;
fn map_elements<F: FnMut(T) -> VortexResult<Transformed<T>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>>;
}Expand description
A container holding a Node’s children, which a function can be applied (or mapped) to.
The trait is also implemented to container types in order to make implementing Node::map_children
and Node::apply_children easier.
Required Methods§
Sourcefn apply_elements<F: FnMut(&'a T) -> VortexResult<TraversalOrder>>(
&'a self,
f: F,
) -> VortexResult<TraversalOrder>
fn apply_elements<F: FnMut(&'a T) -> VortexResult<TraversalOrder>>( &'a self, f: F, ) -> VortexResult<TraversalOrder>
Applies f to all elements of the container, accepting them by reference
Sourcefn map_elements<F: FnMut(T) -> VortexResult<Transformed<T>>>(
self,
f: F,
) -> VortexResult<Transformed<Self>>
fn map_elements<F: FnMut(T) -> VortexResult<Transformed<T>>>( self, f: F, ) -> VortexResult<Transformed<Self>>
Consumes all the children of the node, replacing them with the result of f.
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.