pub struct DiagnosticCollector { /* private fields */ }Expand description
Shared, thread-safe collector for Diagnostic values.
Cloning a DiagnosticCollector yields another handle to the same
underlying buffer (cheap Arc clone) — this is intentional: it allows
passing the collector into worker tasks without ceremony.
Implementations§
Source§impl DiagnosticCollector
impl DiagnosticCollector
Sourcepub fn with_diagnostics(initial: Vec<Diagnostic>) -> Self
pub fn with_diagnostics(initial: Vec<Diagnostic>) -> Self
Construct a collector preseeded with the given diagnostics.
Sourcepub fn push(&self, diag: Diagnostic)
pub fn push(&self, diag: Diagnostic)
Push a single diagnostic. On a poisoned mutex the diagnostic is still pushed using the recovered guard — partial progress is always preserved.
Sourcepub fn extend<I: IntoIterator<Item = Diagnostic>>(&self, diags: I)
pub fn extend<I: IntoIterator<Item = Diagnostic>>(&self, diags: I)
Push multiple diagnostics in one shot, preserving their order.
Sourcepub fn snapshot(&self) -> Vec<Diagnostic>
pub fn snapshot(&self) -> Vec<Diagnostic>
Clone out the full diagnostic list in insertion order.
Sourcepub fn of_severity(&self, severity: Severity) -> Vec<Diagnostic>
pub fn of_severity(&self, severity: Severity) -> Vec<Diagnostic>
All diagnostics of the given severity, in insertion order.
Sourcepub fn at_least(&self, min: Severity) -> Vec<Diagnostic>
pub fn at_least(&self, min: Severity) -> Vec<Diagnostic>
All diagnostics whose severity is at least min (inclusive), in
insertion order.
Sourcepub fn count_of(&self, severity: Severity) -> usize
pub fn count_of(&self, severity: Severity) -> usize
Count of diagnostics of a specific severity.
Sourcepub fn errors(&self) -> Vec<Diagnostic>
pub fn errors(&self) -> Vec<Diagnostic>
Convenience accessor: all Severity::Error diagnostics.
Sourcepub fn warnings(&self) -> Vec<Diagnostic>
pub fn warnings(&self) -> Vec<Diagnostic>
Convenience accessor: all Severity::Warning diagnostics.
Sourcepub fn fatals(&self) -> Vec<Diagnostic>
pub fn fatals(&self) -> Vec<Diagnostic>
Convenience accessor: all Severity::Fatal diagnostics.
Sourcepub fn infos(&self) -> Vec<Diagnostic>
pub fn infos(&self) -> Vec<Diagnostic>
Convenience accessor: all Severity::Info diagnostics.
Sourcepub fn has_blocking(&self) -> bool
pub fn has_blocking(&self) -> bool
Returns true iff at least one diagnostic is blocking
(Error or Fatal).
Sourcepub fn for_expression(&self, idx: usize) -> Vec<Diagnostic>
pub fn for_expression(&self, idx: usize) -> Vec<Diagnostic>
All diagnostics attached to the given expression index, in insertion order.
Sourcepub fn drain(&self) -> Vec<Diagnostic>
pub fn drain(&self) -> Vec<Diagnostic>
Drain the buffer, returning all diagnostics and leaving the collector empty.
Trait Implementations§
Source§impl Clone for DiagnosticCollector
impl Clone for DiagnosticCollector
Source§fn clone(&self) -> DiagnosticCollector
fn clone(&self) -> DiagnosticCollector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more