pub trait FaithfulDisplay {
    // Required method
    fn faithful_fmt(
        &self,
        f: &mut Formatter<'_>,
        prev_span: Span
    ) -> Result<Span, Error>;
}
Expand description

A more faithful Display.

This trait works by accumulating a Span as it formats tokens. By recomputing on the fly on the layout of each token, it’s possible to insert newlines and spaces to respect the initial formatting.

Required Methods§

source

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

Display a token in a faithful way.

Implementations on Foreign Types§

source§

impl FaithfulDisplay for TokenTree

source§

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

source§

impl FaithfulDisplay for Group

source§

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

source§

impl FaithfulDisplay for Ident

source§

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

source§

impl FaithfulDisplay for Literal

source§

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

source§

impl FaithfulDisplay for Punct

source§

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

source§

impl FaithfulDisplay for TokenStream

source§

fn faithful_fmt( &self, f: &mut Formatter<'_>, prev_span: Span ) -> Result<Span, Error>

Implementors§