PrettyDisplay

Trait PrettyDisplay 

Source
pub trait PrettyDisplay: Display {
    // Required method
    fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result;

    // Provided methods
    fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result { ... }
    fn to_string_pretty(&self, limit: usize) -> LPooled<String> { ... }
}

Required Methods§

Source

fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result

Do the actual pretty print. This should not be called directly, it will be called by fmt_pretty when we know it can’t fit on a single line.

Provided Methods§

Source

fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result

This is the user facing fmt method, it will first try to format the expression on a single line, and if that is impossible it will call the pretty printer.

Source

fn to_string_pretty(&self, limit: usize) -> LPooled<String>

Pretty print to a pooled string

Implementors§