Struct syntax_error::Report
source · pub struct Report<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>
impl<S: Span> Report<S>
sourcepub fn write<C: Cache<S::SourceId>, W: Write>(
&self,
cache: C,
w: W
) -> Result<()>
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§impl<S: Span> Report<S>
impl<S: Span> Report<S>
sourcepub fn new<R, ID>(kind: R, src_id: ID, offset: usize) -> ReportBuilder<S>where
ID: Into<<S::SourceId as ToOwned>::Owned>,
R: ReportLevel + 'static,
pub fn new<R, ID>(kind: R, src_id: ID, offset: usize) -> ReportBuilder<S>where ID: Into<<S::SourceId as ToOwned>::Owned>, R: ReportLevel + 'static,
Begin building a new Report
.
sourcepub fn eprint<C: Cache<S::SourceId>>(&self, cache: C) -> Result<()>
pub fn eprint<C: Cache<S::SourceId>>(&self, cache: C) -> Result<()>
Write this diagnostic out to stderr
.
sourcepub fn print<C: Cache<S::SourceId>>(&self, cache: C) -> Result<()>
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§
Auto Trait Implementations§
impl<S = Range<usize>> !RefUnwindSafe for Report<S>
impl<S = Range<usize>> !Send for Report<S>
impl<S = Range<usize>> !Sync for Report<S>
impl<S> Unpin for Report<S>where S: Unpin, <<S as Span>::SourceId as ToOwned>::Owned: Unpin,
impl<S = Range<usize>> !UnwindSafe for Report<S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more