Skip to main content

Formatter

Trait Formatter 

Source
pub trait Formatter: FormatWriter {
    // Provided methods
    fn block(&mut self, f: impl Fn(&mut Self) -> Result) -> Result { ... }
    fn write_token(&mut self, token: impl Display) -> Result { ... }
    fn write_show(&mut self, item: impl ZonefileFmt) -> Result { ... }
    fn write_comment(&mut self, s: impl Display) -> Result { ... }
}
Expand description

A more structured wrapper around a [PresentationWriter]

Provided Methods§

Source

fn block(&mut self, f: impl Fn(&mut Self) -> Result) -> Result

Start a sequence of grouped tokens

The block might be surrounded by ( and ) in a multiline format.

Source

fn write_token(&mut self, token: impl Display) -> Result

Push a token

Source

fn write_show(&mut self, item: impl ZonefileFmt) -> Result

Call the show method on item with this Presenter

Source

fn write_comment(&mut self, s: impl Display) -> Result

Write a comment

This may be ignored.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§