Skip to main content

Print

Trait Print 

Source
pub trait Print: Sized {
    // Required methods
    fn print(&self, f: &mut PrintFmt);
    fn print_non_ws(&self, f: &mut PrintFmt);

    // Provided method
    fn print_to(&self, p: impl FnOnce(&Self, &mut PrintFmt)) -> PrintOutput { ... }
}
Expand description

Printable types

Required Methods§

Source

fn print(&self, f: &mut PrintFmt)

Prints this type onto a writer

Source

fn print_non_ws(&self, f: &mut PrintFmt)

Prints this type onto a writer excluding whitespace

Note that this excludes necessary whitespace too, so this won’t provide valid rust code.

Provided Methods§

Source

fn print_to(&self, p: impl FnOnce(&Self, &mut PrintFmt)) -> PrintOutput

Prints this type using p as the printer function and returns the output

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.

Implementations on Foreign Types§

Source§

impl Print for Comment

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for !

Source§

fn print(&self, _f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for ()

Source§

fn print(&self, _f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for AstStr

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl Print for BlockComment

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for LineComment

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for PureWhitespace

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for Whitespace

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl Print for WhitespaceInner

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl<T0: Print> Print for (T0,)

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T0: Print, T1: Print> Print for (T0, T1)

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T0: Print, T1: Print, T2: Print> Print for (T0, T1, T2)

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T> Print for PhantomData<T>

Source§

fn print(&self, _f: &mut PrintFmt)

Source§

fn print_non_ws(&self, _f: &mut PrintFmt)

Source§

impl<T: ArenaData + Print> Print for ArenaIdx<T>

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T: Print> Print for Option<T>

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T: Print> Print for &T

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T: Print> Print for Box<T>

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Source§

impl<T: Print> Print for Vec<T>

Source§

fn print(&self, f: &mut PrintFmt)

Source§

fn print_non_ws(&self, f: &mut PrintFmt)

Implementors§