pub struct Diagnostic { /* private fields */ }
Expand description
A type representing a diagnostic that is ready to be written to output.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn write<W>(&self, cache: &SourceCache, w: W) -> Result<(), Error>where
W: Write,
pub fn write<W>(&self, cache: &SourceCache, w: W) -> Result<(), Error>where
W: Write,
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 Diagnostic::eprint
or Diagnostic::print
respectively.
Sourcepub fn write_for_stdout<W>(
&self,
cache: &SourceCache,
w: W,
) -> Result<(), Error>where
W: Write,
pub fn write_for_stdout<W>(
&self,
cache: &SourceCache,
w: W,
) -> Result<(), Error>where
W: Write,
Write this diagnostic to an implementor of Write
, assuming that the output is ultimately going to be printed
to stdout
.
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new<R>(kind: R) -> DiagnosticBuilderwhere
R: ReportLevel + 'static,
pub fn new<R>(kind: R) -> DiagnosticBuilderwhere
R: ReportLevel + 'static,
Begin building a new Diagnostic
.
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn eprint(&self, cache: &SourceCache) -> Result<(), Error>
pub fn eprint(&self, cache: &SourceCache) -> Result<(), Error>
Write this diagnostic out to stderr
.
Sourcepub fn print(&self, cache: &SourceCache) -> Result<(), Error>
pub fn print(&self, cache: &SourceCache) -> Result<(), Error>
Write this diagnostic out to stdout
.
In most cases, Diagnostic::eprint
is the
‘more correct’ function to use.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Diagnostic
impl !RefUnwindSafe for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl Unpin for Diagnostic
impl !UnwindSafe for Diagnostic
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