Struct indenter::Indented [−][src]
pub struct Indented<'a, D: ?Sized> { /* fields omitted */ }
Expand description
Helper struct for efficiently indenting multi line display implementations
Explanation
This type will never allocate a string to handle inserting indentation. It instead leverages
the write_str
function that serves as the foundation of the core::fmt::Write
trait. This
lets it intercept each piece of output as its being written to the output buffer. It then
splits on newlines giving slices into the original string. Finally we alternate writing these
lines and the specified indentation to the output buffer.
Implementations
Sets the format to Format::Numbered
with the provided index
Sets the format to Format::Uniform
with the provided static string
Construct an indenter with a user defined format
Trait Implementations
Writes a string slice into this writer, returning whether the write succeeded. Read more