Struct miette::GraphicalReportHandler
source · [−]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
sourceimpl GraphicalReportHandler
impl GraphicalReportHandler
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new GraphicalReportHandler
with the default
GraphicalTheme
. This will use both unicode characters and colors.
sourcepub fn new_themed(theme: GraphicalTheme) -> Self
pub fn new_themed(theme: GraphicalTheme) -> Self
Create a new GraphicalReportHandler
with a given GraphicalTheme
.
sourcepub fn with_links(self, links: bool) -> Self
pub fn with_links(self, links: bool) -> Self
Whether to enable error code linkification using Diagnostic::url()
.
sourcepub fn with_urls(self, urls: bool) -> Self
pub fn with_urls(self, urls: bool) -> Self
Whether to include Diagnostic::url()
in the output.
Disabling this is not recommended, but can be useful for more easily
reproducable tests, as url(docsrs)
links are version-dependent.
sourcepub fn with_theme(self, theme: GraphicalTheme) -> Self
pub fn with_theme(self, theme: GraphicalTheme) -> Self
Set a theme for this handler.
sourcepub fn with_width(self, width: usize) -> Self
pub fn with_width(self, width: usize) -> Self
Sets the width to wrap the report at.
Sets the ‘global’ footer for this handler.
sourcepub fn with_context_lines(self, lines: usize) -> Self
pub fn with_context_lines(self, lines: usize) -> Self
Sets the number of lines of context to show around each error.
sourceimpl GraphicalReportHandler
impl GraphicalReportHandler
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
sourceimpl Clone for GraphicalReportHandler
impl Clone for GraphicalReportHandler
sourcefn clone(&self) -> GraphicalReportHandler
fn clone(&self) -> GraphicalReportHandler
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for GraphicalReportHandler
impl Debug for GraphicalReportHandler
sourceimpl Default for GraphicalReportHandler
impl Default for GraphicalReportHandler
sourceimpl ReportHandler for GraphicalReportHandler
impl ReportHandler for GraphicalReportHandler
sourcefn debug(&self, diagnostic: &dyn Diagnostic, f: &mut Formatter<'_>) -> Result
fn debug(&self, diagnostic: &dyn Diagnostic, f: &mut Formatter<'_>) -> Result
sourcefn display(
&self,
error: &(dyn StdError + 'static),
f: &mut Formatter<'_>
) -> Result
fn display(
&self,
error: &(dyn StdError + 'static),
f: &mut Formatter<'_>
) -> Result
Display
formatsourcefn 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<D> OwoColorize for D
impl<D> OwoColorize for D
sourcefn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
sourcefn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
sourcefn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
sourcefn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
sourcefn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
sourcefn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
sourcefn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
sourcefn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
sourcefn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
sourcefn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
sourcefn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
sourcefn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
sourcefn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
sourcefn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
sourcefn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
sourcefn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
sourcefn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
sourcefn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
sourcefn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
sourcefn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
sourcefn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
sourcefn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
sourcefn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
sourcefn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
sourcefn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
sourcefn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
sourcefn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
sourcefn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
sourcefn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
sourcefn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
sourcefn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
sourcefn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
sourcefn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
sourcefn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
sourcefn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
sourcefn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
sourcefn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
sourcefn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
sourcefn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
sourcefn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
sourcefn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
sourcefn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
sourcefn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
sourcefn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
sourcefn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
sourcefn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
sourcefn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
sourcefn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
sourcefn 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 moresourcefn 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