Skip to main content

CountingVisitor

Struct CountingVisitor 

Source
pub struct CountingVisitor {
    pub models: usize,
    pub enums: usize,
    pub fields: usize,
    pub datasources: usize,
    pub generators: usize,
}
Expand description

Example visitor that counts nodes in the AST.

Fields§

§models: usize

Number of models.

§enums: usize

Number of enums.

§fields: usize

Number of fields.

§datasources: usize

Number of datasources.

§generators: usize

Number of generators.

Trait Implementations§

Source§

impl Debug for CountingVisitor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CountingVisitor

Source§

fn default() -> CountingVisitor

Returns the “default value” for a type. Read more
Source§

impl Visitor for CountingVisitor

Source§

fn visit_datasource(&mut self, datasource: &DatasourceDecl) -> Result<()>

Visit a datasource declaration.
Source§

fn visit_generator(&mut self, generator: &GeneratorDecl) -> Result<()>

Visit a generator declaration.
Source§

fn visit_model(&mut self, model: &ModelDecl) -> Result<()>

Visit a model declaration.
Source§

fn visit_enum(&mut self, enum_decl: &EnumDecl) -> Result<()>

Visit an enum declaration.
Source§

fn visit_field(&mut self, field: &FieldDecl) -> Result<()>

Visit a field declaration.
Source§

fn visit_schema(&mut self, schema: &Schema) -> Result<()>

Visit the entire schema.
Source§

fn visit_declaration(&mut self, decl: &Declaration) -> Result<()>

Visit a top-level declaration.
Source§

fn visit_enum_variant(&mut self, variant: &EnumVariant) -> Result<()>

Visit an enum variant.
Source§

fn visit_field_attribute(&mut self, attr: &FieldAttribute) -> Result<()>

Visit a field attribute.
Source§

fn visit_model_attribute(&mut self, attr: &ModelAttribute) -> Result<()>

Visit a model attribute.
Source§

fn visit_expr(&mut self, expr: &Expr) -> Result<()>

Visit an expression.
Source§

fn visit_config_field(&mut self, field: &ConfigField) -> Result<()>

Visit a configuration field.
Source§

fn visit_type_decl(&mut self, type_decl: &TypeDecl) -> Result<()>

Visit a composite type declaration.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.