Skip to main content

Rule

Trait Rule 

Source
pub trait Rule:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id(&self) -> &str;
    fn level(&self) -> Level;
    fn evaluate(&self, ctx: &Context<'_>) -> Result<Vec<Violation>>;

    // Provided methods
    fn policy_url(&self) -> Option<&str> { ... }
    fn fixer(&self) -> Option<&dyn Fixer> { ... }
}
Expand description

Trait every built-in and plugin rule implements.

Required Methods§

Source

fn id(&self) -> &str

Source

fn level(&self) -> Level

Source

fn evaluate(&self, ctx: &Context<'_>) -> Result<Vec<Violation>>

Provided Methods§

Source

fn policy_url(&self) -> Option<&str>

Source

fn fixer(&self) -> Option<&dyn Fixer>

Optional automatic-fix strategy. Rules whose violations can be mechanically corrected (e.g. creating a missing file, removing a forbidden one, renaming to the correct case) return a Fixer here; the default implementation reports the rule as unfixable.

Implementors§