charon_lib::ast::visitor

Trait BodyVisitable

source
pub trait BodyVisitable: Any {
    // Required methods
    fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>;
    fn drive_body_mut<V: VisitBodyMut>(
        &mut self,
        v: &mut V,
    ) -> ControlFlow<V::Break>;

    // Provided methods
    fn dyn_visit_in_body<T: BodyVisitable>(&self, f: impl FnMut(&T)) { ... }
    fn dyn_visit_in_body_mut<T: BodyVisitable>(&mut self, f: impl FnMut(&mut T)) { ... }
}
Expand description

A smaller visitor group just for function bodies. This explores statements, places and operands, but does not recurse into types.

This defines three traits:

  • BodyVisitable is a trait implemented by all the types listed below; it has a drive_body[_mut] method that takes a VisitBody[Mut] visitor and calls its methods on all the relevant subvalues of self encountered.
  • VisitBody[Mut] is a (pair of) visitor trait(s) that can be implemented by visitors. To define a visitor, implement VisitBody[Mut] and override the methods you need.

Morally this represents the predicate for<V: VisitBody[Mut]> Self: Drive[Mut]<BodyVisitableWrapper<V>>

Required Methods§

source

fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>

Recursively visit this type with the provided visitor. This calls the visitor’s visit_$any method if it exists, otherwise visit_inner.

source

fn drive_body_mut<V: VisitBodyMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>

Recursively visit this type with the provided visitor. This calls the visitor’s visit_$any method if it exists, otherwise visit_inner.

Provided Methods§

source

fn dyn_visit_in_body<T: BodyVisitable>(&self, f: impl FnMut(&T))

Visit all occurrences of that type inside self, in pre-order traversal.

source

fn dyn_visit_in_body_mut<T: BodyVisitable>(&mut self, f: impl FnMut(&mut T))

Visit all occurrences of that type inside self, in pre-order traversal.

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: BodyVisitable, B: BodyVisitable> BodyVisitable for (A, B)

source§

fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>

source§

fn drive_body_mut<V: VisitBodyMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>

source§

impl<T: BodyVisitable> BodyVisitable for Option<T>

source§

fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>

source§

fn drive_body_mut<V: VisitBodyMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>

source§

impl<T: BodyVisitable> BodyVisitable for Box<T>

source§

fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>

source§

fn drive_body_mut<V: VisitBodyMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>

source§

impl<T: BodyVisitable> BodyVisitable for Vec<T>

source§

fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>

source§

fn drive_body_mut<V: VisitBodyMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>

Implementors§

source§

impl BodyVisitable for AggregateKind

source§

impl BodyVisitable for BinOp

source§

impl BodyVisitable for BorrowKind

source§

impl BodyVisitable for FieldProjKind

source§

impl BodyVisitable for FunIdOrTraitMethodRef

source§

impl BodyVisitable for NullOp

source§

impl BodyVisitable for Operand

source§

impl BodyVisitable for PlaceKind

source§

impl BodyVisitable for ProjectionElem

source§

impl BodyVisitable for Rvalue

source§

impl BodyVisitable for UnOp

source§

impl BodyVisitable for AbortKind

source§

impl BodyVisitable for FnOperand

source§

impl BodyVisitable for charon_lib::ast::llbc_ast::RawStatement

source§

impl BodyVisitable for Switch

source§

impl BodyVisitable for ConstGeneric

source§

impl BodyVisitable for IntegerTy

source§

impl BodyVisitable for RefKind

source§

impl BodyVisitable for TypeId

source§

impl BodyVisitable for charon_lib::ast::ullbc_ast::RawStatement

source§

impl BodyVisitable for RawTerminator

source§

impl BodyVisitable for SwitchTargets

source§

impl BodyVisitable for ScalarValue

source§

impl BodyVisitable for ConstantExpr

source§

impl BodyVisitable for FnPtr

source§

impl BodyVisitable for Place

source§

impl BodyVisitable for Assert

source§

impl BodyVisitable for Call

source§

impl BodyVisitable for GlobalDeclRef

source§

impl BodyVisitable for Locals

source§

impl BodyVisitable for FunDeclId

source§

impl BodyVisitable for TypeDeclId

source§

impl BodyVisitable for Block

source§

impl BodyVisitable for charon_lib::ast::llbc_ast::Statement

source§

impl BodyVisitable for Span

source§

impl BodyVisitable for FieldId

source§

impl BodyVisitable for GenericArgs

source§

impl BodyVisitable for Ty

source§

impl BodyVisitable for VariantId

source§

impl BodyVisitable for BlockData

source§

impl BodyVisitable for BlockId

source§

impl BodyVisitable for charon_lib::ast::ullbc_ast::Statement

source§

impl BodyVisitable for Terminator

source§

impl BodyVisitable for VarId

source§

impl BodyVisitable for charon_lib::ast::llbc_ast::ExprBody

source§

impl BodyVisitable for charon_lib::ast::ullbc_ast::ExprBody

source§

impl<I: Idx, T: BodyVisitable> BodyVisitable for Vector<I, T>