Trait mz_expr::visit::Visit

source ·
pub trait Visit {
Show 21 methods // Required methods fn visit_post<F>(&self, f: &mut F) -> Result<(), RecursionLimitError> where F: FnMut(&Self); fn visit_post_nolimit<F>(&self, f: &mut F) where F: FnMut(&Self); fn visit_mut_post<F>( &mut self, f: &mut F ) -> Result<(), RecursionLimitError> where F: FnMut(&mut Self); fn visit_mut_post_nolimit<F>(&mut self, f: &mut F) where F: FnMut(&mut Self); fn try_visit_post<F, E>(&self, f: &mut F) -> Result<(), E> where F: FnMut(&Self) -> Result<(), E>, E: From<RecursionLimitError>; fn try_visit_mut_post<F, E>(&mut self, f: &mut F) -> Result<(), E> where F: FnMut(&mut Self) -> Result<(), E>, E: From<RecursionLimitError>; fn visit_pre<F>(&self, f: &mut F) -> Result<(), RecursionLimitError> where F: FnMut(&Self); fn visit_pre_with_context<Context, AccFun, Visitor>( &self, init: Context, acc_fun: &mut AccFun, visitor: &mut Visitor ) -> Result<(), RecursionLimitError> where Context: Clone, AccFun: FnMut(Context, &Self) -> Context, Visitor: FnMut(&Context, &Self); fn visit_pre_nolimit<F>(&self, f: &mut F) where F: FnMut(&Self); fn visit_mut_pre<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError> where F: FnMut(&mut Self); fn visit_mut_pre_nolimit<F>(&mut self, f: &mut F) where F: FnMut(&mut Self); fn try_visit_pre<F, E>(&self, f: &mut F) -> Result<(), E> where F: FnMut(&Self) -> Result<(), E>, E: From<RecursionLimitError>; fn try_visit_mut_pre<F, E>(&mut self, f: &mut F) -> Result<(), E> where F: FnMut(&mut Self) -> Result<(), E>, E: From<RecursionLimitError>; fn visit_pre_post<F1, F2>( &self, pre: &mut F1, post: &mut F2 ) -> Result<(), RecursionLimitError> where F1: FnMut(&Self) -> Option<Vec<&Self>>, F2: FnMut(&Self); fn visit_pre_post_nolimit<F1, F2>(&self, pre: &mut F1, post: &mut F2) where F1: FnMut(&Self) -> Option<Vec<&Self>>, F2: FnMut(&Self); fn visit_mut_pre_post<F1, F2>( &mut self, pre: &mut F1, post: &mut F2 ) -> Result<(), RecursionLimitError> where F1: FnMut(&mut Self) -> Option<Vec<&mut Self>>, F2: FnMut(&mut Self); fn visit_mut_pre_post_nolimit<F1, F2>( &mut self, pre: &mut F1, post: &mut F2 ) where F1: FnMut(&mut Self) -> Option<Vec<&mut Self>>, F2: FnMut(&mut Self); fn visit<V>(&self, visitor: &mut V) -> Result<(), RecursionLimitError> where Self: Sized, V: Visitor<Self>; fn visit_mut<V>( &mut self, visitor: &mut V ) -> Result<(), RecursionLimitError> where Self: Sized, V: VisitorMut<Self>; fn try_visit<V, E>(&self, visitor: &mut V) -> Result<(), E> where Self: Sized, V: TryVisitor<Self, E>, E: From<RecursionLimitError>; fn try_visit_mut<V, E>(&mut self, visitor: &mut V) -> Result<(), E> where Self: Sized, V: TryVisitorMut<Self, E>, E: From<RecursionLimitError>;
}
Expand description

A trait for types that can recursively visit their children of the same type.

This trait is automatically implemented for all implementors of VisitChildren.

All methods provided by this trait ensure that the stack is grown as needed, to avoid stack overflows when traversing deeply recursive objects. They also enforce a recursion limit of RECURSION_LIMIT by returning an error when that limit is exceeded.

There are also *_nolimit methods that don’t enforce a recursion limit. Those methods are deprecated and should not be used.

Required Methods§

source

fn visit_post<F>(&self, f: &mut F) -> Result<(), RecursionLimitError>
where F: FnMut(&Self),

Post-order immutable infallible visitor for self.

source

fn visit_post_nolimit<F>(&self, f: &mut F)
where F: FnMut(&Self),

👎Deprecated: Use visit_post instead.

Post-order immutable infallible visitor for self. Does not enforce a recursion limit.

source

fn visit_mut_post<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError>
where F: FnMut(&mut Self),

Post-order mutable infallible visitor for self.

source

fn visit_mut_post_nolimit<F>(&mut self, f: &mut F)
where F: FnMut(&mut Self),

👎Deprecated: Use visit_mut_post instead.

Post-order mutable infallible visitor for self. Does not enforce a recursion limit.

source

fn try_visit_post<F, E>(&self, f: &mut F) -> Result<(), E>
where F: FnMut(&Self) -> Result<(), E>, E: From<RecursionLimitError>,

Post-order immutable fallible visitor for self.

source

fn try_visit_mut_post<F, E>(&mut self, f: &mut F) -> Result<(), E>

Post-order mutable fallible visitor for self.

source

fn visit_pre<F>(&self, f: &mut F) -> Result<(), RecursionLimitError>
where F: FnMut(&Self),

Pre-order immutable infallible visitor for self.

source

fn visit_pre_with_context<Context, AccFun, Visitor>( &self, init: Context, acc_fun: &mut AccFun, visitor: &mut Visitor ) -> Result<(), RecursionLimitError>
where Context: Clone, AccFun: FnMut(Context, &Self) -> Context, Visitor: FnMut(&Context, &Self),

Pre-order immutable infallible visitor for self, which also accumulates context information along the path from the root to the current node’s parent. acc_fun is a similar closure as in fold. The accumulated context is passed to the visitor, along with the current node.

For example, one can use this on a MirScalarExpr to tell the visitor whether the current subexpression has a negation somewhere above it.

When using it on a MirRelationExpr, one has to be mindful that Let bindings are not followed, i.e., the context won’t include what happens with a Let binding in some other MirRelationExpr where the binding occurs in a Get.

source

fn visit_pre_nolimit<F>(&self, f: &mut F)
where F: FnMut(&Self),

👎Deprecated: Use visit_pre instead.

Pre-order immutable infallible visitor for self. Does not enforce a recursion limit.

source

fn visit_mut_pre<F>(&mut self, f: &mut F) -> Result<(), RecursionLimitError>
where F: FnMut(&mut Self),

Pre-order mutable infallible visitor for self.

source

fn visit_mut_pre_nolimit<F>(&mut self, f: &mut F)
where F: FnMut(&mut Self),

👎Deprecated: Use visit_mut_pre instead.

Pre-order mutable infallible visitor for self. Does not enforce a recursion limit.

source

fn try_visit_pre<F, E>(&self, f: &mut F) -> Result<(), E>
where F: FnMut(&Self) -> Result<(), E>, E: From<RecursionLimitError>,

Pre-order immutable fallible visitor for self.

source

fn try_visit_mut_pre<F, E>(&mut self, f: &mut F) -> Result<(), E>

Pre-order mutable fallible visitor for self.

source

fn visit_pre_post<F1, F2>( &self, pre: &mut F1, post: &mut F2 ) -> Result<(), RecursionLimitError>
where F1: FnMut(&Self) -> Option<Vec<&Self>>, F2: FnMut(&Self),

A generalization of Visit::visit_pre and Visit::visit_post.

The function pre runs on self before it runs on any of the children. The function post runs on children first before the parent.

Optionally, pre can return which children, if any, should be visited (default is to visit all children).

source

fn visit_pre_post_nolimit<F1, F2>(&self, pre: &mut F1, post: &mut F2)
where F1: FnMut(&Self) -> Option<Vec<&Self>>, F2: FnMut(&Self),

👎Deprecated: Use visit instead.

A generalization of Visit::visit_pre and Visit::visit_post. Does not enforce a recursion limit.

The function pre runs on self before it runs on any of the children. The function post runs on children first before the parent.

Optionally, pre can return which children, if any, should be visited (default is to visit all children).

source

fn visit_mut_pre_post<F1, F2>( &mut self, pre: &mut F1, post: &mut F2 ) -> Result<(), RecursionLimitError>

👎Deprecated: Use visit_mut instead.

A generalization of Visit::visit_mut_pre and Visit::visit_mut_post.

The function pre runs on self before it runs on any of the children. The function post runs on children first before the parent.

Optionally, pre can return which children, if any, should be visited (default is to visit all children).

source

fn visit_mut_pre_post_nolimit<F1, F2>(&mut self, pre: &mut F1, post: &mut F2)

👎Deprecated: Use visit_mut_pre_post instead.

A generalization of Visit::visit_mut_pre and Visit::visit_mut_post. Does not enforce a recursion limit.

The function pre runs on self before it runs on any of the children. The function post runs on children first before the parent.

Optionally, pre can return which children, if any, should be visited (default is to visit all children).

source

fn visit<V>(&self, visitor: &mut V) -> Result<(), RecursionLimitError>
where Self: Sized, V: Visitor<Self>,

source

fn visit_mut<V>(&mut self, visitor: &mut V) -> Result<(), RecursionLimitError>
where Self: Sized, V: VisitorMut<Self>,

source

fn try_visit<V, E>(&self, visitor: &mut V) -> Result<(), E>
where Self: Sized, V: TryVisitor<Self, E>, E: From<RecursionLimitError>,

source

fn try_visit_mut<V, E>(&mut self, visitor: &mut V) -> Result<(), E>
where Self: Sized, V: TryVisitorMut<Self, E>, E: From<RecursionLimitError>,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: VisitChildren<T>> Visit for T