Struct ariadne::Report

source ·
pub struct Report<'a, S: Span = Range<usize>> { /* private fields */ }
Expand description

A type representing a diagnostic that is ready to be written to output.

Implementations§

source§

impl<S: Span> Report<'_, S>

source

pub fn write<C: Cache<S::SourceId>, W: Write>( &self, cache: C, w: W ) -> Result<()>

Write this diagnostic to an implementor of Write.

If using the concolor feature, this method assumes that the output is ultimately going to be printed to stderr. If you are printing to stdout, use the write_for_stdout method instead.

If you wish to write to stderr or stdout, you can do so via Report::eprint or Report::print respectively.

source

pub fn write_for_stdout<C: Cache<S::SourceId>, W: Write>( &self, cache: C, w: W ) -> Result<()>

Write this diagnostic to an implementor of Write, assuming that the output is ultimately going to be printed to stdout.

source§

impl<S: Span> Report<'_, S>

source

pub fn build<Id: Into<<S::SourceId as ToOwned>::Owned>>( kind: ReportKind<'_>, src_id: Id, offset: usize ) -> ReportBuilder<'_, S>

Begin building a new Report.

source

pub fn eprint<C: Cache<S::SourceId>>(&self, cache: C) -> Result<()>

Write this diagnostic out to stderr.

source

pub fn print<C: Cache<S::SourceId>>(&self, cache: C) -> Result<()>

Write this diagnostic out to stdout.

In most cases, Report::eprint is the ‘more correct’ function to use.

Trait Implementations§

source§

impl<'a, S: Span> Debug for Report<'a, S>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, S> RefUnwindSafe for Report<'a, S>

§

impl<'a, S> Send for Report<'a, S>
where S: Send, <<S as Span>::SourceId as ToOwned>::Owned: Send,

§

impl<'a, S> Sync for Report<'a, S>
where S: Sync, <<S as Span>::SourceId as ToOwned>::Owned: Sync,

§

impl<'a, S> Unpin for Report<'a, S>
where S: Unpin, <<S as Span>::SourceId as ToOwned>::Owned: Unpin,

§

impl<'a, S> UnwindSafe for Report<'a, S>
where S: UnwindSafe, <<S as Span>::SourceId as ToOwned>::Owned: UnwindSafe,

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

§

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

§

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.