pub struct NarratableReportHandler { /* private fields */ }
Expand description
ReportHandler
that renders plain text and avoids extraneous graphics.
It’s optimized for screen readers and braille users, but is also used in any
non-graphical environments, such as non-TTY output.
Implementations§
source§impl NarratableReportHandler
impl NarratableReportHandler
sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new NarratableReportHandler
. There are no customization
options.
sourcepub const fn with_cause_chain(self) -> Self
pub const fn with_cause_chain(self) -> Self
Include the cause chain of the top-level error in the report, if available.
sourcepub const fn without_cause_chain(self) -> Self
pub const fn without_cause_chain(self) -> Self
Do not include the cause chain of the top-level error in the report.
Set the footer to be displayed at the end of the report.
sourcepub const fn with_context_lines(self, lines: usize) -> Self
pub const fn with_context_lines(self, lines: usize) -> Self
Sets the number of lines of context to show around each error.
source§impl NarratableReportHandler
impl NarratableReportHandler
sourcepub fn render_report(
&self,
f: &mut impl Write,
diagnostic: &dyn Diagnostic,
) -> Result
pub fn render_report( &self, f: &mut impl Write, diagnostic: &dyn Diagnostic, ) -> Result
Render a Diagnostic
. This function is mostly internal and meant to
be called by the toplevel ReportHandler
handler, but is
made public to make it easier (possible) to test in isolation from
global state.
Trait Implementations§
source§impl Clone for NarratableReportHandler
impl Clone for NarratableReportHandler
source§fn clone(&self) -> NarratableReportHandler
fn clone(&self) -> NarratableReportHandler
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NarratableReportHandler
impl Debug for NarratableReportHandler
source§impl Default for NarratableReportHandler
impl Default for NarratableReportHandler
source§impl ReportHandler for NarratableReportHandler
impl ReportHandler for NarratableReportHandler
source§fn debug(&self, diagnostic: &dyn Diagnostic, f: &mut Formatter<'_>) -> Result
fn debug(&self, diagnostic: &dyn Diagnostic, f: &mut Formatter<'_>) -> Result
Define the report format Read more
source§fn display(
&self,
error: &(dyn StdError + 'static),
f: &mut Formatter<'_>,
) -> Result
fn display( &self, error: &(dyn StdError + 'static), f: &mut Formatter<'_>, ) -> Result
Override for the
Display
formatsource§fn track_caller(&mut self, location: &'static Location<'static>)
fn track_caller(&mut self, location: &'static Location<'static>)
Store the location of the caller who constructed this error report
Auto Trait Implementations§
impl Freeze for NarratableReportHandler
impl RefUnwindSafe for NarratableReportHandler
impl Send for NarratableReportHandler
impl Sync for NarratableReportHandler
impl Unpin for NarratableReportHandler
impl UnwindSafe for NarratableReportHandler
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)