pub trait Visitor: Sized {
// Provided methods
fn visit_source_file(&mut self, source_file: &SourceFile) { ... }
fn visit_decl(&mut self, decl: &AstDecl) { ... }
fn visit_package_spec(&mut self, _name: &str, _span: &Span) { ... }
fn visit_package_body(&mut self, _name: &str, _span: &Span) { ... }
fn visit_procedure(&mut self, _name: &str, _span: &Span) { ... }
fn visit_function(&mut self, _name: &str, _span: &Span) { ... }
fn visit_trigger(&mut self, _name: &str, _span: &Span) { ... }
fn visit_view(&mut self, _name: &str, _span: &Span) { ... }
fn visit_type_spec(&mut self, _name: &str, _span: &Span) { ... }
fn visit_type_body(&mut self, _name: &str, _span: &Span) { ... }
fn visit_ddl(&mut self, _kind: &str, _span: &Span) { ... }
fn visit_unknown(&mut self, _span: &Span) { ... }
}Expand description
Trait for visiting AST nodes.
Every method has a default implementation that recurses into children via
the corresponding walk_* function. Override only the methods you care
about.
§Example
ⓘ
use plsql_parser::visit::{Visitor, walk};
use plsql_parser::ast::{SourceFile, AstDecl};
struct DeclCounter {
count: usize,
}
impl Visitor for DeclCounter {
fn visit_decl(&mut self, decl: &AstDecl) {
self.count += 1;
walk::walk_decl(self, decl);
}
}Provided Methods§
Sourcefn visit_source_file(&mut self, source_file: &SourceFile)
fn visit_source_file(&mut self, source_file: &SourceFile)
Visit a source file (the root of the AST).
Default: walk all declarations.
Sourcefn visit_decl(&mut self, decl: &AstDecl)
fn visit_decl(&mut self, decl: &AstDecl)
Visit a top-level declaration.
Default: walk the specific declaration variant.
Sourcefn visit_package_spec(&mut self, _name: &str, _span: &Span)
fn visit_package_spec(&mut self, _name: &str, _span: &Span)
Visit a package specification.
Sourcefn visit_package_body(&mut self, _name: &str, _span: &Span)
fn visit_package_body(&mut self, _name: &str, _span: &Span)
Visit a package body.
Sourcefn visit_procedure(&mut self, _name: &str, _span: &Span)
fn visit_procedure(&mut self, _name: &str, _span: &Span)
Visit a standalone procedure.
Sourcefn visit_function(&mut self, _name: &str, _span: &Span)
fn visit_function(&mut self, _name: &str, _span: &Span)
Visit a standalone function.
Sourcefn visit_trigger(&mut self, _name: &str, _span: &Span)
fn visit_trigger(&mut self, _name: &str, _span: &Span)
Visit a trigger.
Sourcefn visit_view(&mut self, _name: &str, _span: &Span)
fn visit_view(&mut self, _name: &str, _span: &Span)
Visit a view.
Sourcefn visit_type_spec(&mut self, _name: &str, _span: &Span)
fn visit_type_spec(&mut self, _name: &str, _span: &Span)
Visit a type specification.
Sourcefn visit_type_body(&mut self, _name: &str, _span: &Span)
fn visit_type_body(&mut self, _name: &str, _span: &Span)
Visit a type body.
Sourcefn visit_unknown(&mut self, _span: &Span)
fn visit_unknown(&mut self, _span: &Span)
Visit an unknown/unclassified declaration (R13).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".