polars_plan::plans::visitor

Trait TreeWalker

Source
pub trait TreeWalker: Sized {
    type Arena;

    // Required methods
    fn apply_children<F: FnMut(&Self, &Self::Arena) -> PolarsResult<VisitRecursion>>(
        &self,
        op: &mut F,
        arena: &Self::Arena,
    ) -> PolarsResult<VisitRecursion>;
    fn map_children<F: FnMut(Self, &mut Self::Arena) -> PolarsResult<Self>>(
        self,
        op: &mut F,
        arena: &mut Self::Arena,
    ) -> PolarsResult<Self>;

    // Provided methods
    fn visit<V: Visitor<Node = Self, Arena = Self::Arena>>(
        &self,
        visitor: &mut V,
        arena: &Self::Arena,
    ) -> PolarsResult<VisitRecursion> { ... }
    fn rewrite<R: RewritingVisitor<Node = Self, Arena = Self::Arena>>(
        self,
        rewriter: &mut R,
        arena: &mut Self::Arena,
    ) -> PolarsResult<Self> { ... }
}
Expand description

An implementor of this trait decides how and in which order its nodes get traversed Implemented for crate::dsl::Expr and AexprNode.

Required Associated Types§

Required Methods§

Source

fn apply_children<F: FnMut(&Self, &Self::Arena) -> PolarsResult<VisitRecursion>>( &self, op: &mut F, arena: &Self::Arena, ) -> PolarsResult<VisitRecursion>

Source

fn map_children<F: FnMut(Self, &mut Self::Arena) -> PolarsResult<Self>>( self, op: &mut F, arena: &mut Self::Arena, ) -> PolarsResult<Self>

Provided Methods§

Source

fn visit<V: Visitor<Node = Self, Arena = Self::Arena>>( &self, visitor: &mut V, arena: &Self::Arena, ) -> PolarsResult<VisitRecursion>

Walks all nodes in depth-first-order.

Source

fn rewrite<R: RewritingVisitor<Node = Self, Arena = Self::Arena>>( self, rewriter: &mut R, arena: &mut Self::Arena, ) -> PolarsResult<Self>

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.

Implementors§