Enum Style

Source
pub enum Style {
    Error,
    Warning,
    Note,
    Help,
    Custom(char, char, Color),
}
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(char, char, Color)

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§

Source§

impl Style

Source

pub const fn new(line: char, marker: char, color: Color) -> Self

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.

Source

pub fn line(&self) -> char

The character used to underline the highlighted section.

Source

pub fn marker(&self) -> char

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

Source

pub fn color(&self) -> Color

Get the color used to draw the highlight.

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Style

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnwindSafe for Style

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.