Skip to main content

FmtAdapter

Trait FmtAdapter 

pub trait FmtAdapter: Write {
    // Provided methods
    fn indent(&mut self) -> Indent<'_, Self> { ... }
    fn indent_with<I>(&mut self, indent: I) -> Indent<'_, Self, I>
       where I: Display { ... }
    fn delimit<O, E>(&mut self, open: O, close: E) -> Delimit<'_, Self, E>
       where O: Display,
             E: Display { ... }
    fn delimit_indented<O, E>(
        &mut self,
        open: O,
        close: E,
    ) -> DelimitIndent<'_, Self, E>
       where O: Display,
             E: Display { ... }
    fn list<Iter, Sep>(&mut self, items: Iter, sep: Sep) -> Result<(), Error>
       where Iter: IntoIterator,
             <Iter as IntoIterator>::Item: Display,
             Sep: Display { ... }
    fn list_wrap<Iter, Sep, O, E>(
        &mut self,
        open: O,
        items: Iter,
        sep: Sep,
        close: E,
    ) -> Result<(), Error>
       where Iter: IntoIterator,
             <Iter as IntoIterator>::Item: Display,
             Sep: Display,
             O: Display,
             E: Display { ... }
}

Provided Methods§

fn indent(&mut self) -> Indent<'_, Self>

Indents by one level.

fn indent_with<I>(&mut self, indent: I) -> Indent<'_, Self, I>
where I: Display,

Pastes indent after each newline.

fn delimit<O, E>(&mut self, open: O, close: E) -> Delimit<'_, Self, E>
where O: Display, E: Display,

Delimits a section with open and close.

fn delimit_indented<O, E>( &mut self, open: O, close: E, ) -> DelimitIndent<'_, Self, E>
where O: Display, E: Display,

Delimits a section with open and close, raising the indent level within.

fn list<Iter, Sep>(&mut self, items: Iter, sep: Sep) -> Result<(), Error>
where Iter: IntoIterator, <Iter as IntoIterator>::Item: Display, Sep: Display,

Formats bracketed lists of the kind (Item (Comma Item)*)?

fn list_wrap<Iter, Sep, O, E>( &mut self, open: O, items: Iter, sep: Sep, close: E, ) -> Result<(), Error>
where Iter: IntoIterator, <Iter as IntoIterator>::Item: Display, Sep: Display, O: Display, E: Display,

Wraps a list in open and close. This differs from FmtAdapter::delimit because it prints nothing if the list is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<W> FmtAdapter for W
where W: Write + ?Sized,