Skip to main content

FmtAdapter

Trait FmtAdapter 

Source
pub trait FmtAdapter: Write {
    // Provided methods
    fn indent(&mut self) -> Indent<'_, Self> { ... }
    fn indent_with(&mut self, indent: &'static str) -> Indent<'_, Self> { ... }
    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<Item, Sep>(&mut self, items: &[Item], sep: Sep) -> Result<(), Error>
       where Item: Display,
             Sep: Display { ... }
    fn list_end<Item, Sep, End>(
        &mut self,
        items: &[Item],
        sep: Sep,
        end: End,
    ) -> Result<(), Error>
       where Item: Display,
             Sep: Display,
             End: Display { ... }
    fn list_wrap<Item, Sep, O, E>(
        &mut self,
        open: O,
        items: &[Item],
        sep: Sep,
        close: E,
    ) -> Result<(), Error>
       where Item: Display,
             Sep: Display,
             O: Display,
             E: Display { ... }
}

Provided Methods§

Source

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

Indents by one level.

Source

fn indent_with(&mut self, indent: &'static str) -> Indent<'_, Self>

Pastes indent after each newline.

Source

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.

Source

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.

Source

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

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

Source

fn list_end<Item, Sep, End>( &mut self, items: &[Item], sep: Sep, end: End, ) -> Result<(), Error>
where Item: Display, Sep: Display, End: Display,

Source

fn list_wrap<Item, Sep, O, E>( &mut self, open: O, items: &[Item], sep: Sep, close: E, ) -> Result<(), Error>
where 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", so this trait is not object safe.

Implementors§

Source§

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