Trait Print

Source
pub trait Print {
    // Required method
    fn fmt_with(
        &self,
        f: &mut Formatter<'_>,
        options: &Options,
        indent: usize,
    ) -> Result;

    // Provided methods
    fn pretty_print(&self) -> Printed<'_, Self> { ... }
    fn compact_print(&self) -> Printed<'_, Self> { ... }
    fn inline_print(&self) -> Printed<'_, Self> { ... }
    fn print_with(&self, options: Options) -> Printed<'_, Self> { ... }
}
Expand description

Print methods.

Required Methods§

Source

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result

Provided Methods§

Source

fn pretty_print(&self) -> Printed<'_, Self>

Print the value with Options::pretty options.

Source

fn compact_print(&self) -> Printed<'_, Self>

Print the value with Options::compact options.

Source

fn inline_print(&self) -> Printed<'_, Self>

Print the value with Options::inline options.

Source

fn print_with(&self, options: Options) -> Printed<'_, Self>

Print the value with the given options.

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 bool

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, _options: &Options, _indent: usize, ) -> Result

Source§

impl<'a, T: Print + ?Sized> Print for &'a T

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result

Source§

impl<'c, T: PrintWithContext<C>, C> Print for Contextual<T, &'c C>

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result

Source§

impl<T: Print> Print for Stripped<T>

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result

Source§

impl<T: Print, M> Print for Meta<T, M>

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result

Implementors§