Struct miette::MietteHandlerOpts
source · pub struct MietteHandlerOpts { /* private fields */ }
Expand description
Create a custom MietteHandler
from options.
§Example
miette::set_hook(Box::new(|_| {
Box::new(miette::MietteHandlerOpts::new()
.terminal_links(true)
.unicode(false)
.context_lines(3)
.build())
}))
Implementations§
source§impl MietteHandlerOpts
impl MietteHandlerOpts
sourcepub fn terminal_links(self, linkify: bool) -> Self
pub fn terminal_links(self, linkify: bool) -> Self
If true, specify whether the graphical handler will make codes be clickable links in supported terminals. Defaults to auto-detection based on known supported terminals.
sourcepub fn graphical_theme(self, theme: GraphicalTheme) -> Self
pub fn graphical_theme(self, theme: GraphicalTheme) -> Self
Set a graphical theme for the handler when rendering in graphical mode.
Use force_graphical()
to force
graphical mode. This option overrides
color()
.
sourcepub fn with_syntax_highlighting(
self,
highlighter: impl Highlighter + Send + Sync + 'static,
) -> Self
pub fn with_syntax_highlighting( self, highlighter: impl Highlighter + Send + Sync + 'static, ) -> Self
Set a syntax highlighter when rendering in graphical mode.
Use force_graphical()
to
force graphical mode.
Syntax highlighting is disabled by default unless the
syntect-highlighter
feature is enabled. Call this method
to override the default and use a custom highlighter
implmentation instead.
Use
without_syntax_highlighting()
To disable highlighting completely.
Setting this option will not force color output. In all cases, the
current color configuration via
color()
takes precedence over
highlighter configuration.
sourcepub fn without_syntax_highlighting(self) -> Self
pub fn without_syntax_highlighting(self) -> Self
Disables syntax highlighting when rendering in graphical mode.
Use force_graphical()
to
force graphical mode.
Syntax highlighting is disabled by default unless the
syntect-highlighter
feature is enabled. Call this method if you want
to disable highlighting when building with this feature.
sourcepub fn wrap_lines(self, wrap_lines: bool) -> Self
pub fn wrap_lines(self, wrap_lines: bool) -> Self
If true, long lines can be wrapped.
If false, long lines will not be broken when they exceed the width.
Defaults to true.
sourcepub fn break_words(self, break_words: bool) -> Self
pub fn break_words(self, break_words: bool) -> Self
If true, long words can be broken when wrapping.
If false, long words will not be broken when they exceed the width.
Defaults to true.
sourcepub fn word_separator(self, word_separator: WordSeparator) -> Self
pub fn word_separator(self, word_separator: WordSeparator) -> Self
Sets the textwrap::WordSeparator
to use when determining wrap points.
sourcepub fn word_splitter(self, word_splitter: WordSplitter) -> Self
pub fn word_splitter(self, word_splitter: WordSplitter) -> Self
Sets the textwrap::WordSplitter
to use when determining wrap points.
sourcepub fn with_cause_chain(self) -> Self
pub fn with_cause_chain(self) -> Self
Include the cause chain of the top-level error in the report.
sourcepub fn without_cause_chain(self) -> Self
pub fn without_cause_chain(self) -> Self
Do not include the cause chain of the top-level error in the report.
sourcepub fn color(self, color: bool) -> Self
pub fn color(self, color: bool) -> Self
If true, colors will be used during graphical rendering, regardless of whether or not the terminal supports them.
If false, colors will never be used.
If unspecified, colors will be used only if the terminal supports them.
The actual format depends on the value of
MietteHandlerOpts::rgb_colors
.
sourcepub fn rgb_colors(self, color: RgbColors) -> Self
pub fn rgb_colors(self, color: RgbColors) -> Self
Controls which color format to use if colors are used in graphical rendering.
The default is Never
.
This value does not control whether or not colors are being used in the
first place. That is handled by the MietteHandlerOpts::color
setting. If colors are not being used, the value of rgb_colors
has
no effect.
sourcepub fn unicode(self, unicode: bool) -> Self
pub fn unicode(self, unicode: bool) -> Self
If true, forces unicode display for graphical output. If set to false, forces ASCII art display.
sourcepub fn force_graphical(self, force: bool) -> Self
pub fn force_graphical(self, force: bool) -> Self
If true, graphical rendering will be used regardless of terminal detection.
sourcepub fn force_narrated(self, force: bool) -> Self
pub fn force_narrated(self, force: bool) -> Self
If true, forces use of the narrated renderer.
Set a footer to be displayed at the bottom of the report.
sourcepub fn context_lines(self, context_lines: usize) -> Self
pub fn context_lines(self, context_lines: usize) -> Self
Sets the number of context lines before and after a span to display.
sourcepub fn build(self) -> MietteHandler
pub fn build(self) -> MietteHandler
Builds a MietteHandler
from this builder.
Trait Implementations§
source§impl Clone for MietteHandlerOpts
impl Clone for MietteHandlerOpts
source§fn clone(&self) -> MietteHandlerOpts
fn clone(&self) -> MietteHandlerOpts
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MietteHandlerOpts
impl Debug for MietteHandlerOpts
source§impl Default for MietteHandlerOpts
impl Default for MietteHandlerOpts
source§fn default() -> MietteHandlerOpts
fn default() -> MietteHandlerOpts
Auto Trait Implementations§
impl Freeze for MietteHandlerOpts
impl !RefUnwindSafe for MietteHandlerOpts
impl Send for MietteHandlerOpts
impl Sync for MietteHandlerOpts
impl Unpin for MietteHandlerOpts
impl !UnwindSafe for MietteHandlerOpts
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
source§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 moresource§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