Skip to main content

RuleCapability

Trait RuleCapability 

Source
pub trait RuleCapability: Send + Sync {
    // Required methods
    fn id(&self) -> &'static str;
    fn parameters(&self) -> Vec<ParameterDescriptor>;
    fn evaluate(
        &self,
        context: &RuleContext<'_>,
        rule: &CompiledRule,
    ) -> CapabilityEvaluation;

    // Provided method
    fn grades_deviation(&self) -> bool { ... }
}
Expand description

Trusted code selected by a package capability ID; packages never supply executable code.

Required Methods§

Source

fn id(&self) -> &'static str

Stable trusted capability ID.

Source

fn parameters(&self) -> Vec<ParameterDescriptor>

Strict accepted parameters.

Source

fn evaluate( &self, context: &RuleContext<'_>, rule: &CompiledRule, ) -> CapabilityEvaluation

Evaluates an already-validated rule request.

Provided Methods§

Source

fn grades_deviation(&self) -> bool

Whether findings report how far a value misses its bound (CapabilityEvaluation::push_graded_finding), so a rule may grade them with severity bands. A rule declaring bands on a capability that answers false fails compilation.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§