Skip to main content

Rule

Trait Rule 

Source
pub trait Rule<'a> {
    // Required method
    fn check(
        &self,
        node: Node<'a>,
        prog: &AstNode<Program>,
    ) -> Result<Vec<Discovered>>;
}
Expand description

Check the provided AST for any found rule violations.

The Rule trait is automatically implemented for a few other types, but it can also be manually implemented as required.

Required Methods§

Source

fn check( &self, node: Node<'a>, prog: &AstNode<Program>, ) -> Result<Vec<Discovered>>

Check the AST at this specific node for any Finding(s).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, FnT> Rule<'a> for FnT
where FnT: Fn(Node<'a>, &Node<Program>) -> Result<Vec<Discovered>>,