pub struct GraphicalReportHandler { /* private fields */ }
Expand description
A ReportHandler
that displays a given Report
in a
quasi-graphical way, using terminal colors, unicode drawing characters, and
other such things.
This is the default reporter bundled with miette
.
This printer can be customized by using new_themed()
and handing it a
GraphicalTheme
of your own creation (or using one of its own defaults!)
See set_hook()
for more details on customizing your global
printer.
Implementations§
source§impl GraphicalReportHandler
impl GraphicalReportHandler
sourcepub fn new() -> GraphicalReportHandler
pub fn new() -> GraphicalReportHandler
Create a new GraphicalReportHandler
with the default
GraphicalTheme
. This will use both unicode characters and colors.
sourcepub fn new_themed(theme: GraphicalTheme) -> GraphicalReportHandler
pub fn new_themed(theme: GraphicalTheme) -> GraphicalReportHandler
Create a new GraphicalReportHandler
with a given GraphicalTheme
.
sourcepub fn tab_width(self, width: usize) -> GraphicalReportHandler
pub fn tab_width(self, width: usize) -> GraphicalReportHandler
Set the displayed tab width in spaces.
sourcepub fn with_links(self, links: bool) -> GraphicalReportHandler
pub fn with_links(self, links: bool) -> GraphicalReportHandler
Whether to enable error code linkification using Diagnostic::url()
.
sourcepub fn with_theme(self, theme: GraphicalTheme) -> GraphicalReportHandler
pub fn with_theme(self, theme: GraphicalTheme) -> GraphicalReportHandler
Set a theme for this handler.
sourcepub fn with_width(self, width: usize) -> GraphicalReportHandler
pub fn with_width(self, width: usize) -> GraphicalReportHandler
Sets the width to wrap the report at.
Sets the ‘global’ footer for this handler.
sourcepub fn with_context_lines(self, lines: usize) -> GraphicalReportHandler
pub fn with_context_lines(self, lines: usize) -> GraphicalReportHandler
Sets the number of lines of context to show around each error.
source§impl GraphicalReportHandler
impl GraphicalReportHandler
sourcepub fn render_report(
&self,
f: &mut impl Write,
diagnostic: &dyn Diagnostic
) -> Result<(), Error>
pub fn render_report( &self, f: &mut impl Write, diagnostic: &dyn Diagnostic ) -> Result<(), Error>
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 GraphicalReportHandler
impl Clone for GraphicalReportHandler
source§fn clone(&self) -> GraphicalReportHandler
fn clone(&self) -> GraphicalReportHandler
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GraphicalReportHandler
impl Debug for GraphicalReportHandler
source§impl Default for GraphicalReportHandler
impl Default for GraphicalReportHandler
source§fn default() -> GraphicalReportHandler
fn default() -> GraphicalReportHandler
source§impl ReportHandler for GraphicalReportHandler
impl ReportHandler for GraphicalReportHandler
source§fn debug(
&self,
diagnostic: &dyn Diagnostic,
f: &mut Formatter<'_>
) -> Result<(), Error>
fn debug( &self, diagnostic: &dyn Diagnostic, f: &mut Formatter<'_> ) -> Result<(), Error>
source§fn display(
&self,
error: &(dyn Error + 'static),
f: &mut Formatter<'_>
) -> Result<(), Error>
fn display( &self, error: &(dyn Error + 'static), f: &mut Formatter<'_> ) -> Result<(), Error>
Display
formatsource§fn track_caller(&mut self, location: &'static Location<'static>)
fn track_caller(&mut self, location: &'static Location<'static>)
Auto Trait Implementations§
impl RefUnwindSafe for GraphicalReportHandler
impl Send for GraphicalReportHandler
impl Sync for GraphicalReportHandler
impl Unpin for GraphicalReportHandler
impl UnwindSafe for GraphicalReportHandler
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more