#[non_exhaustive]pub struct LintResult {
pub diagnostics: Vec<Diagnostic>,
pub truncated: bool,
pub candidates_processed: usize,
pub candidates_total: usize,
}Expand description
Result of a lint pass — diagnostics without source modification.
#[non_exhaustive] ensures future lint-time observations (per-rule
timing histograms, decoder posterior quartiles, etc.) can be added
without further breaking downstream callers. Adding the attribute
itself in spec 005 IS a one-time breaking change for external
callers that previously brace-constructed or exhaustively
pattern-matched LintResult; from this version on, external
callers MUST construct via Default::default() plus public field
assignment (struct-update syntax is only allowed in-crate):
use marque_engine::LintResult;
let mut result = LintResult::default();
result.diagnostics.clear();Spec 005 added truncated, candidates_processed, and
candidates_total to surface deadline-driven cooperative
cancellation.
Phase 1 status (current build): deadline enforcement is not
wired yet. Lint passes run to completion regardless of
LintOptions::deadline, so truncated is always false and
both candidate-count fields are always 0. The semantics below
describe the Phase 2 behavior that lands in tasks T007–T009.
Once Phase 2 wiring lands: a fully completed pass reports
truncated: false with candidates_processed == candidates_total. An already-expired deadline returns
immediately with truncated: true and both counts at 0.
Mid-document expiry produces truncated: true with
0 < candidates_processed < candidates_total.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.diagnostics: Vec<Diagnostic>§truncated: booltrue when the lint pass aborted before processing every
scanner-emitted candidate due to deadline expiry. The
diagnostics vector contains every diagnostic produced from
candidates that were processed before the abort. Spec §R3.
candidates_processed: usizeNumber of scanner-emitted candidates the engine started
processing past the per-candidate deadline check before
returning. Counted at the top of each candidate iteration
(after the deadline check, before any per-candidate work),
so it includes every iteration that survived the cancellation
boundary — fully-rule-evaluated candidates AND structural
“early-continue” candidates such as page-break resets,
empty-span skips, and ambiguous-recognition skips. This
definition is what makes candidates_processed == candidates_total hold on a non-truncated pass; if the
counter only fired on the rule-loop completion path,
page-break candidates would silently break that invariant
on multi-page documents. On a truncated pass,
candidates_processed < candidates_total and the delta is
the count of candidates the deadline preempted.
candidates_total: usizeTotal number of scanner-emitted candidates (the post-scanner, pre-rule-loop count). Populated from the scanner output regardless of whether the pass completed.
Implementations§
Source§impl LintResult
impl LintResult
pub fn is_clean(&self) -> bool
pub fn error_count(&self) -> usize
pub fn warn_count(&self) -> usize
Sourcepub fn info_count(&self) -> usize
pub fn info_count(&self) -> usize
Number of diagnostics at Severity::Info — visible, but not
counted toward either the error/fix exit gate
(EX_DIAG_ERROR) or the warn exit gate (EX_DIAG_WARN). See
Severity docs for the tonal distinction (Info = “probably
intentional, worth surfacing”; Warn = “this might be wrong”).
Sourcepub fn suggest_count(&self) -> usize
pub fn suggest_count(&self) -> usize
Number of diagnostics at Severity::Suggest — the
suggest-don’t-fix channel. Visible in lint output but the
engine never auto-applies the attached fix (issue #235 / #186
PR-3). Like Info, contributes to neither exit-code gate.