Struct miette::DiagnosticSnippet [−][src]
pub struct DiagnosticSnippet<'a> {
pub message: Option<&'a str>,
pub source: &'a dyn Source,
pub context: SourceSpan,
pub highlights: Option<Vec<SourceSpan>>,
}
Expand description
A snippet from a Source to be displayed with a message and possibly some highlights.
Fields
message: Option<&'a str>
Explanation of this specific diagnostic snippet.
source: &'a dyn Source
A Source that can be used to read the actual text of a source.
context: SourceSpan
The primary SourceSpan where this diagnostic is located.
highlights: Option<Vec<SourceSpan>>
Additional SourceSpans that mark specific sections of the span, for example, to underline specific text within the larger span. They’re paired with labels that should be applied to those sections.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for DiagnosticSnippet<'a>
impl<'a> Send for DiagnosticSnippet<'a>
impl<'a> Sync for DiagnosticSnippet<'a>
impl<'a> Unpin for DiagnosticSnippet<'a>
impl<'a> !UnwindSafe for DiagnosticSnippet<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Set the foreground color generically Read more
Set the background color generically. Read more
Change the foreground color to black
Change the foreground color to black
Change the foreground color to red
Change the foreground color to red
Change the foreground color to green
Change the foreground color to green
Change the foreground color to yellow
Change the foreground color to yellow
Change the foreground color to blue
Change the foreground color to blue
Change the foreground color to magenta
Change the foreground color to magenta
Change the foreground color to purple
Change the foreground color to purple
Change the foreground color to cyan
Change the foreground color to cyan
Change the foreground color to white
Change the foreground color to white
Change the foreground color to bright black
Change the foreground color to bright black
Change the foreground color to bright red
Change the foreground color to bright red
Change the foreground color to bright green
Change the foreground color to bright green
Change the foreground color to bright yellow
Change the foreground color to bright yellow
Change the foreground color to bright blue
Change the foreground color to bright blue
Change the foreground color to bright magenta
Change the foreground color to bright magenta
Change the foreground color to bright purple
Change the foreground color to bright purple
Change the foreground color to bright cyan
Change the foreground color to bright cyan
Change the foreground color to bright white
Change the foreground color to bright white
Make the text bold
Make the text dim
Make the text italicized
Make the text italicized
Make the text blink
Make the text blink (but fast!)
Swap the foreground and background colors
Hide the text
Cross out the text
fn color<Color>(&'a self, color: Color) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
fn color<Color>(&'a self, color: Color) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more
fn on_color<Color>(&'a self, color: Color) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
fn on_color<Color>(&'a self, color: Color) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&'a self
) -> FgColorDisplay<'a, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&'a self
) -> FgColorDisplay<'a, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&'a self
) -> BgColorDisplay<'a, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&'a self
) -> BgColorDisplay<'a, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
Sets the foreground color to an RGB value.
Sets the background color to an RGB value.