Struct indenter::CodeFormatter[][src]

pub struct CodeFormatter<'a, T> { /* fields omitted */ }

Helper struct for efficiently dedent and indent multi line display implementations

Explanation

This type allocates a string once to get the formatted result and then uses the internal formatter efficiently to: first dedent the output, then re-indent to the desired level.

Implementations

impl<'a, T: Write> CodeFormatter<'a, T>[src]

pub fn new<S: Into<String>>(f: &'a mut T, indentation: S) -> Self[src]

Wrap the formatter f, use indentation as base string indentation and return a new formatter that implements std::fmt::Write that can be used with the macro write!()

pub fn set_level(&mut self, level: u32)[src]

Set the indentation level to a specific value

pub fn indent(&mut self, inc: u32)[src]

Increase the indentation level by inc

pub fn dedent(&mut self, inc: u32)[src]

Decrease the indentation level by inc

Trait Implementations

impl<'a, T: Write> Write for CodeFormatter<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for CodeFormatter<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for CodeFormatter<'a, T> where
    T: Send

impl<'a, T> Sync for CodeFormatter<'a, T> where
    T: Sync

impl<'a, T> Unpin for CodeFormatter<'a, T>

impl<'a, T> !UnwindSafe for CodeFormatter<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.