pub trait Rule: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn name(&self) -> &str;
fn dimension(&self) -> Dimension;
fn severity(&self) -> Severity;
fn check(&self, ctx: &ProjectContext) -> RuleResult;
// Provided methods
fn applies_to(&self, _project_type: &ProjectType) -> bool { ... }
fn pass(&self) -> RuleResult { ... }
fn fail(&self, reason: &str, suggestion: Suggestion) -> RuleResult { ... }
fn warn(&self, reason: &str, suggestion: Suggestion) -> RuleResult { ... }
fn skip(&self) -> RuleResult { ... }
}Expand description
The rule trait — each check implements this
Required Methods§
fn id(&self) -> &str
fn name(&self) -> &str
fn dimension(&self) -> Dimension
fn severity(&self) -> Severity
Sourcefn check(&self, ctx: &ProjectContext) -> RuleResult
fn check(&self, ctx: &ProjectContext) -> RuleResult
Execute the check.
Provided Methods§
Sourcefn applies_to(&self, _project_type: &ProjectType) -> bool
fn applies_to(&self, _project_type: &ProjectType) -> bool
Whether this rule applies to the detected project type.
Sourcefn pass(&self) -> RuleResult
fn pass(&self) -> RuleResult
Helper to produce a pass result.
Sourcefn fail(&self, reason: &str, suggestion: Suggestion) -> RuleResult
fn fail(&self, reason: &str, suggestion: Suggestion) -> RuleResult
Helper to produce a fail result with suggestion.
Sourcefn warn(&self, reason: &str, suggestion: Suggestion) -> RuleResult
fn warn(&self, reason: &str, suggestion: Suggestion) -> RuleResult
Helper to produce a warn result with suggestion.
Sourcefn skip(&self) -> RuleResult
fn skip(&self) -> RuleResult
Helper to produce a skip result.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".