Skip to main content

LintResult

Struct LintResult 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§diagnostics: Vec<Diagnostic>§truncated: bool

true 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: usize

Number 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: usize

Total 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

Source

pub fn is_clean(&self) -> bool

Source

pub fn error_count(&self) -> usize

Source

pub fn warn_count(&self) -> usize

Source

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”).

Source

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.

Source

pub fn fix_count(&self) -> usize

Number of diagnostics that are configured at Severity::Fix AND carry an actual FixProposal. A diagnostic at Fix severity but with fix: None is not counted, since it cannot produce an AppliedFix downstream.

Trait Implementations§

Source§

impl Debug for LintResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LintResult

Source§

fn default() -> LintResult

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more