Crate indent_display

source ·
Expand description

Indent

This is a fairly simple indented display system designed for standard library (not simply core) applications.

use indent_display::{Indenter, NullOptions, DefaultIndentedDisplay, IndentedDisplay};
let mut stdout = std::io::stdout();
let mut ind = Indenter::new(&mut stdout, "  ", &NullOptions {});
"Not indented\n".indent(&mut ind);
{
    let mut sub = ind.sub();
    "Indented once with two spaces\n".indent(&mut ind);
}
{
    let mut sub = ind.push("...");
    "Indented once with three dots\n".indent(&mut ind);
    {
        let mut sub = sub.push("***");
        "Indented with three dots and three stars\nAnd so is this".indent(&mut ind);
    }
    {
        let mut sub = sub.sub();
        "Indented with three dots and two spaces stars\nAnd so is this".indent(&mut ind);
    }
}
"Not indented\n".indent(&mut ind);

!

Structs

Traits