NodeContainer

Trait NodeContainer 

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

Source

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

Source

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.

Implementations on Foreign Types§

Source§

impl<'a> NodeContainer<'a, Arc<dyn Operator>> for OperatorRef

Source§

fn apply_elements<F: FnMut(&'a Self) -> VortexResult<TraversalOrder>>( &'a self, f: F, ) -> VortexResult<TraversalOrder>

Source§

fn map_elements<F: FnMut(Self) -> VortexResult<Transformed<Self>>>( self, f: F, ) -> VortexResult<Transformed<Self>>

Source§

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

Source§

impl<'a, T: 'a, C: NodeContainer<'a, T>> NodeContainer<'a, T> for [C; 2]

Source§

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

Source§

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

Implementors§