pub struct Engine { /* private fields */ }Expand description
A configured engine instance.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new(config: Config, rule_sets: Vec<Box<dyn RuleSet>>) -> Self
pub fn new(config: Config, rule_sets: Vec<Box<dyn RuleSet>>) -> Self
Create a new engine with the given configuration and rule sets.
Sourcepub fn with_clock(
config: Config,
rule_sets: Vec<Box<dyn RuleSet>>,
clock: Box<dyn Clock>,
) -> Self
pub fn with_clock( config: Config, rule_sets: Vec<Box<dyn RuleSet>>, clock: Box<dyn Clock>, ) -> Self
Create an engine with a custom clock (for deterministic tests).
Sourcepub fn lint(&self, source: &[u8]) -> LintResult
pub fn lint(&self, source: &[u8]) -> LintResult
Lint a UTF-8 text buffer. Returns diagnostics without modifying input.
Sourcepub fn fix(&self, source: &[u8], mode: FixMode) -> FixResult
pub fn fix(&self, source: &[u8], mode: FixMode) -> FixResult
Lint and apply fixes. Returns fixed source and audit log.
Fix application order follows FR-016: (span.end DESC, span.start DESC, rule_id ASC, replacement ASC) so reverse-byte application preserves
earlier-span offsets and equal-span ties break deterministically.
Uses the confidence threshold configured in the engine’s Config.
To supply a per-call override (e.g., from a --confidence CLI flag
or an HTTP request field), use Engine::fix_with_threshold.
Sourcepub fn fix_with_threshold(
&self,
source: &[u8],
mode: FixMode,
threshold_override: Option<f32>,
) -> Result<FixResult, InvalidThreshold>
pub fn fix_with_threshold( &self, source: &[u8], mode: FixMode, threshold_override: Option<f32>, ) -> Result<FixResult, InvalidThreshold>
Lint and apply fixes using an optional per-call confidence threshold.
When threshold_override is Some, it replaces the config-level
threshold for this call only and is validated against [0.0, 1.0].
When None, the engine falls back to Config::confidence_threshold.