Struct ufmt::Formatter

source ·
pub struct Formatter<'w, W>
where W: uWrite + ?Sized,
{ /* private fields */ }
Expand description

Configuration for formatting

Implementations§

source§

impl<'w, W> Formatter<'w, W>
where W: uWrite + ?Sized,

source

pub fn debug_list(&mut self) -> Result<DebugList<'_, 'w, W>, W::Error>

Creates a DebugList builder designed to assist with creation of uDebug implementations for list-like structures.

source

pub fn debug_map(&mut self) -> Result<DebugMap<'_, 'w, W>, W::Error>

Creates a DebugMap builder designed to assist with creation of uDebug implementations for map-like structures.

source

pub fn debug_set(&mut self) -> Result<DebugSet<'_, 'w, W>, W::Error>

Creates a DebugSet builder designed to assist with creation of uDebug implementations for set-like structures.

source

pub fn debug_struct( &mut self, name: &str ) -> Result<DebugStruct<'_, 'w, W>, W::Error>

Creates a DebugStruct builder designed to assist with creation of uDebug implementations for structs.

source

pub fn debug_tuple( &mut self, name: &str ) -> Result<DebugTuple<'_, 'w, W>, W::Error>

Creates a DebugTuple builder designed to assist with creation of uDebug implementations for tuple structs.

source§

impl<'w, W> Formatter<'w, W>
where W: uWrite + ?Sized,

source

pub fn new(writer: &'w mut W) -> Self

Creates a formatter from the given writer

source

pub fn pretty( &mut self, f: impl FnOnce(&mut Self) -> Result<(), W::Error> ) -> Result<(), W::Error>

Execute the closure with pretty-printing enabled

source

pub fn write_char(&mut self, c: char) -> Result<(), W::Error>

Writes a character to the underlying buffer contained within this formatter.

source

pub fn write_str(&mut self, s: &str) -> Result<(), W::Error>

Writes a string slice to the underlying buffer contained within this formatter.

Auto Trait Implementations§

§

impl<'w, W: ?Sized> RefUnwindSafe for Formatter<'w, W>
where W: RefUnwindSafe,

§

impl<'w, W: ?Sized> Send for Formatter<'w, W>
where W: Send,

§

impl<'w, W: ?Sized> Sync for Formatter<'w, W>
where W: Sync,

§

impl<'w, W: ?Sized> Unpin for Formatter<'w, W>

§

impl<'w, W> !UnwindSafe for Formatter<'w, W>

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

§

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.