Trait TreeNodeContainer

Source
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§

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a, C0: TreeNodeContainer<'a, T>, C1: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for (C0, C1)

Source§

impl<'a, T: 'a, C0: TreeNodeContainer<'a, T>, C1: TreeNodeContainer<'a, T>, C2: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for (C0, C1, C2)

Source§

impl<'a, T: 'a, C: TreeNodeContainer<'a, T> + Clone> TreeNodeContainer<'a, T> for Arc<C>

Source§

impl<'a, T: 'a, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for Option<C>

Source§

impl<'a, T: 'a, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for Box<C>

Source§

impl<'a, T: 'a, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for Vec<C>

Source§

impl<'a, T: 'a, K: Eq + Hash, C: TreeNodeContainer<'a, T>> TreeNodeContainer<'a, T> for HashMap<K, C>

Implementors§