Enum source_span::fmt::Style[][src]

pub enum Style {
    Error,
    Warning,
    Note,
    Help,
    Custom(charcharColor),
}
Expand description

Highlight format description.

Specifies how the highlight should be rendered:

  • What character to use to underline highlights.
1 | fn main() {
2 |     println!("Hello World!")
  |              ^++++++++++++^ highlighting this string
3 | }

In this example, the underline character is +.

  • What boundary marker character to use to point the first and last elements of a highlight.
1 |   fn main() {
  |  ___________^
2 | |     println!("Hello World!")
3 | | }
  | |_^ this span covers more than one line

In this example, the boundary marker is ^. Note that the underline character is not used.

Colors

If the colors feature is enabled, it is also possible to set a color to draw the lines. This will also make the highlights more bright (or bold), along with the line numbers.

Variants

Error

Red curvy underline.

Warning

Yellow curvy underline.

Note

Blue straight underline.

Help

Green straight underline.

Custom(charcharColor)

Custom highlight format.

Specifies the underline character, the boundary marker and the color (if the colors feature is enabled) used to render the highlight.

Implementations

Create a new custom highlight style.

The line character is user to draw the line under the highlighted sections. The marker character is used to point to the first and last elements of the section when relevant.

The character used to underline the highlighted section.

The character used to point the first and last element of the span when relevant.

Get the color used to draw the highlight.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.