Skip to main content

PrintWithSize

Trait PrintWithSize 

Source
pub trait PrintWithSize {
    // Required method
    fn fmt_with_size(
        &self,
        f: &mut Formatter<'_>,
        options: &Options,
        indent: usize,
        sizes: &[Size],
        index: &mut usize,
    ) -> Result<(), Error>;
}
Expand description

Printing with precomputed sizes.

Implemented by the value types that can be expanded over several lines. sizes holds the layout decisions produced by PrecomputeSize, in depth-first order, and index walks through them as printing proceeds.

Required Methods§

Source

fn fmt_with_size( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, sizes: &[Size], index: &mut usize, ) -> Result<(), Error>

Writes the value to f, taking its layout from sizes[*index].

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> PrintWithSize for &T
where T: PrintWithSize + ?Sized,

Source§

fn fmt_with_size( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, sizes: &[Size], index: &mut usize, ) -> Result<(), Error>

Source§

impl<T> PrintWithSize for Vec<T>
where T: PrintWithSize,

Source§

fn fmt_with_size( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, sizes: &[Size], index: &mut usize, ) -> Result<(), Error>

Implementors§