Trait glsl_lang::visitor::HostMut

source ·
pub trait HostMut {
    // Required method
    fn visit_mut<V>(&mut self, visitor: &mut V)
       where V: VisitorMut;
}
Expand description

Part of the AST that can be visited.

You shouldn’t have to worry about this type nor how to implement it – it’s completely implemented for you. However, it works in a pretty simple way: any implementor of the host trait can be used with a visitor.

The idea is that visiting an AST node is a two-step process:

  • First, you can get your visitor called once as soon as an interesting node gets visited. For instance, if your visitor has an implementation for visiting expressions, everytime an expression gets visited, your visitor will run.
  • If your implementation of visiting an AST node returns Visit::Children and if the given node has children, the visitor will go deeper, invoking other calls if you have defined any. A typical pattern you might want to do is to implement your visitor to gets run on all typenames. Since expressions contains variables, you will get your visitor called once again there.
  • Notice that since visitors are mutable, you can accumulate a state as you go deeper in the AST to implement various checks and validations.

Note that this trait exists in two versions: an immutable one, Host, which doesn’t allow you to mutate the AST (but takes a &), and a mutable one, HostMut, which allows for AST mutation.

Required Methods§

source

fn visit_mut<V>(&mut self, visitor: &mut V)
where V: VisitorMut,

Visit an AST node.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> HostMut for Option<T>
where T: HostMut,

source§

fn visit_mut<V>(&mut self, visitor: &mut V)
where V: VisitorMut,

source§

impl<T> HostMut for Box<T>
where T: HostMut,

source§

fn visit_mut<V>(&mut self, visitor: &mut V)
where V: VisitorMut,

Implementors§

source§

impl HostMut for TranslationUnit

source§

impl HostMut for ArraySpecifier

source§

impl HostMut for ArraySpecifierDimension

source§

impl HostMut for ArrayedIdentifier

source§

impl HostMut for AssignmentOp

source§

impl HostMut for BinaryOp

source§

impl HostMut for Block

source§

impl HostMut for CaseLabel

source§

impl HostMut for CompoundStatement

source§

impl HostMut for Condition

source§

impl HostMut for Declaration

source§

impl HostMut for Expr

source§

impl HostMut for ExprStatement

source§

impl HostMut for ExternalDeclaration

source§

impl HostMut for ForInitStatement

source§

impl HostMut for ForRestStatement

source§

impl HostMut for FullySpecifiedType

source§

impl HostMut for FunIdentifier

source§

impl HostMut for FunctionDefinition

source§

impl HostMut for FunctionParameterDeclaration

source§

impl HostMut for FunctionParameterDeclarator

source§

impl HostMut for FunctionPrototype

source§

impl HostMut for Identifier

source§

impl HostMut for InitDeclaratorList

source§

impl HostMut for Initializer

source§

impl HostMut for InterpolationQualifier

source§

impl HostMut for IterationStatement

source§

impl HostMut for JumpStatement

source§

impl HostMut for LayoutQualifier

source§

impl HostMut for LayoutQualifierSpec

source§

impl HostMut for PrecisionQualifier

source§

impl HostMut for Preprocessor

source§

impl HostMut for PreprocessorDefine

source§

impl HostMut for PreprocessorElseIf

source§

impl HostMut for PreprocessorError

source§

impl HostMut for PreprocessorExtension

source§

impl HostMut for PreprocessorExtensionBehavior

source§

impl HostMut for PreprocessorExtensionName

source§

impl HostMut for PreprocessorIf

source§

impl HostMut for PreprocessorIfDef

source§

impl HostMut for PreprocessorIfNDef

source§

impl HostMut for PreprocessorInclude

source§

impl HostMut for PreprocessorLine

source§

impl HostMut for PreprocessorPragma

source§

impl HostMut for PreprocessorUndef

source§

impl HostMut for PreprocessorVersion

source§

impl HostMut for PreprocessorVersionProfile

source§

impl HostMut for SelectionRestStatement

source§

impl HostMut for SelectionStatement

source§

impl HostMut for SingleDeclaration

source§

impl HostMut for SingleDeclarationNoType

source§

impl HostMut for Statement

source§

impl HostMut for StorageQualifier

source§

impl HostMut for StructFieldSpecifier

source§

impl HostMut for StructSpecifier

source§

impl HostMut for SwitchStatement

source§

impl HostMut for TypeName

source§

impl HostMut for TypeQualifier

source§

impl HostMut for TypeQualifierSpec

source§

impl HostMut for TypeSpecifier

source§

impl HostMut for TypeSpecifierNonArray

source§

impl HostMut for UnaryOp