pub trait TreeNodeContainer<'a, T: 'a>: Sized {
// Required methods
fn apply_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&'a self,
f: F,
) -> Result<TreeNodeRecursion>;
fn map_elements<F: FnMut(T) -> Result<Transformed<T>>>(
self,
f: F,
) -> Result<Transformed<Self>>;
}
Expand description
TreeNodeContainer
contains elements that a function can be applied on or mapped.
The elements of the container are siblings so the continuation rules are similar to
TreeNodeRecursion::visit_sibling
/ Transformed::transform_sibling
.
Required Methods§
Sourcefn apply_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>(
&'a self,
f: F,
) -> Result<TreeNodeRecursion>
fn apply_elements<F: FnMut(&'a T) -> Result<TreeNodeRecursion>>( &'a self, f: F, ) -> Result<TreeNodeRecursion>
Applies f
to all elements of the container.
This method is usually called from TreeNode::apply_children
implementations as
a node is actually a container of the node’s children.
Sourcefn map_elements<F: FnMut(T) -> Result<Transformed<T>>>(
self,
f: F,
) -> Result<Transformed<Self>>
fn map_elements<F: FnMut(T) -> Result<Transformed<T>>>( self, f: F, ) -> Result<Transformed<Self>>
Maps all elements of the container with f
.
This method is usually called from TreeNode::map_children
implementations as
a node is actually a container of the node’s children.
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.