pub struct Report { /* private fields */ }Expand description
A collection of errors can may built up over the course of an operation.
To construct a report, see Context::new_report(). The context that
constructs a report is the only one whose SpanIds should be passed into
it; doing otherwise will result in unspecified output (or probably a panic).
Implementations§
Source§impl Report
impl Report
Sourcepub fn builtins<'a>(&'a self, spec: &'a Spec) -> Builtins<'_>
pub fn builtins<'a>(&'a self, spec: &'a Spec) -> Builtins<'_>
Returns a wrapper for accessing commonly-used, built-in message types.
See Builtins.
Sourcepub fn error(&self, message: impl Display) -> Diagnostic
pub fn error(&self, message: impl Display) -> Diagnostic
Adds a new error to this report.
The returned Diagnostic object can be used to add spans, notes, and
remarks, to generate a richer diagnostic.
Sourcepub fn warn(&self, message: impl Display) -> Diagnostic
pub fn warn(&self, message: impl Display) -> Diagnostic
Adds a new warning to this report.
The returned Diagnostic object can be used to add spans, notes, and
remarks, to generate a richer diagnostic.
Sourcepub fn note(&self, message: impl Display) -> Diagnostic
pub fn note(&self, message: impl Display) -> Diagnostic
Adds a new top-level note to this report.
The returned Diagnostic object can be used to add spans, notes, and
remarks, to generate a richer diagnostic.
Sourcepub fn fatal<T>(&self) -> Result<T, Fatal>
pub fn fatal<T>(&self) -> Result<T, Fatal>
Returns a Fatal regardless of whether this report contains any errors.
Sourcepub fn fatal_or<T>(&self, ok: T) -> Result<T, Fatal>
pub fn fatal_or<T>(&self, ok: T) -> Result<T, Fatal>
If this report contains any errors, returns Err(Fatal);
otherwise, it returns Ok(ok).
This is a useful function for completing some operation that could have generated error diagnostics.
See Fatal.