Struct annotate_snippets::renderer::Renderer

source ·
pub struct Renderer { /* private fields */ }
Expand description

A renderer for Messages

Implementations§

source§

impl Renderer

source

pub const fn plain() -> Self

No terminal styling

source

pub const fn styled() -> Self

Default terminal styling

§Note

When testing styled terminal output, see the testing-colors feature

source

pub const fn anonymized_line_numbers( self, anonymized_line_numbers: bool, ) -> Self

Anonymize line numbers

This enables (or disables) line number anonymization. When enabled, line numbers are replaced with LL.

§Example
  --> $DIR/whitespace-trimming.rs:4:193
   |
LL | ...                   let _: () = 42;
   |                                   ^^ expected (), found integer
   |
source

pub const fn term_width(self, term_width: usize) -> Self

source

pub const fn error(self, style: Style) -> Self

Set the output style for error

source

pub const fn warning(self, style: Style) -> Self

Set the output style for warning

source

pub const fn info(self, style: Style) -> Self

Set the output style for info

source

pub const fn note(self, style: Style) -> Self

Set the output style for note

source

pub const fn help(self, style: Style) -> Self

Set the output style for help

source

pub const fn line_no(self, style: Style) -> Self

Set the output style for line numbers

source

pub const fn emphasis(self, style: Style) -> Self

Set the output style for emphasis

source

pub const fn none(self, style: Style) -> Self

Set the output style for none

source

pub fn render<'a>(&'a self, msg: Message<'a>) -> impl Display + 'a

Render a snippet into a Displayable object

Trait Implementations§

source§

impl Clone for Renderer

source§

fn clone(&self) -> Renderer

Returns a copy 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 Debug for Renderer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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,

§

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>,

§

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>,

§

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.