Skip to main content

TypedRule

Trait TypedRule 

Source
pub(super) trait TypedRule:
    Send
    + Sync
    + 'static {
    type Violation: TypedRuleViolation<Rule = Self> + FormattedRuleViolation + 'static;

    // Required methods
    fn code() -> &'static str;
    fn check(&self, ctx: &FileContext<'_>) -> Vec<Self::Violation>;
}
Expand description

Typed rule contract implemented by each concrete rule.

Keeping the associated violation here prevents a rule from returning the violation type owned by another rule, while still allowing dyn Rule.

Required Associated Types§

Required Methods§

Source

fn code() -> &'static str

Source

fn check(&self, ctx: &FileContext<'_>) -> Vec<Self::Violation>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§