Formatter

Struct Formatter 

Source
pub struct Formatter<'fmt> { /* private fields */ }
Expand description

The Formatter is the biome_console equivalent to std::fmt::Formatter: it’s never constructed directly by consumers, and can only be used through the mutable reference passed to implementations of the Display trait). It manages the state of the markup to print, and implementations of Display can call into its methods to append content into the current printing session

Implementations§

Source§

impl<'fmt> Formatter<'fmt>

Source

pub fn new(writer: &'fmt mut dyn Write) -> Self

Create a new instance of the Formatter using the provided writer for printing

Source

pub fn wrap_writer<'b: 'c, 'c>( &'b mut self, wrap: impl FnOnce(&'b mut dyn Write) -> &'c mut dyn Write, ) -> Formatter<'c>

Source

pub fn write_markup(&mut self, markup: Markup<'_>) -> Result<()>

Write a piece of markup into this formatter

Source

pub fn write_str(&mut self, content: &str) -> Result<()>

Write a slice of text into this formatter

Source

pub fn write_fmt(&mut self, content: Arguments<'_>) -> Result<()>

Write formatted text into this formatter

Auto Trait Implementations§

§

impl<'fmt> Freeze for Formatter<'fmt>

§

impl<'fmt> !RefUnwindSafe for Formatter<'fmt>

§

impl<'fmt> !Send for Formatter<'fmt>

§

impl<'fmt> !Sync for Formatter<'fmt>

§

impl<'fmt> Unpin for Formatter<'fmt>

§

impl<'fmt> !UnwindSafe for Formatter<'fmt>

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