Report

Struct Report 

Source
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

Source

pub fn builtins<'a>(&'a self, spec: &'a Spec) -> Builtins<'_>

Returns a wrapper for accessing commonly-used, built-in message types.

See Builtins.

Source

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.

Source

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.

Source

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.

Source

pub fn fatal<T>(&self) -> Result<T, Fatal>

Returns a Fatal regardless of whether this report contains any errors.

Source

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.

Source

pub fn collate(&self)

Collates all of the “unsorted diagnostics” into the “sorted diagnostics”, sorting them by thread id.

This ensures that all diagnostics coming from a particular thread are together.

Source

pub fn write_out(&self, sink: impl Write) -> Result<()>

Writes out the contents of this diagnostic to sink.

Auto Trait Implementations§

§

impl Freeze for Report

§

impl RefUnwindSafe for Report

§

impl Send for Report

§

impl Sync for Report

§

impl Unpin for Report

§

impl UnwindSafe for Report

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, 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.