mz_ore::str

Trait IndentLike

Source
pub trait IndentLike {
    // Required methods
    fn indented<F>(&mut self, f: F) -> Result
       where F: FnMut(&mut Self) -> Result;
    fn indented_if<F>(&mut self, guard: bool, f: F) -> Result
       where F: FnMut(&mut Self) -> Result;
}
Expand description

Convenience methods for pretty-printing based on indentation that are automatically available for context objects that can be mutably referenced as an Indent instance.

Required Methods§

Source

fn indented<F>(&mut self, f: F) -> Result
where F: FnMut(&mut Self) -> Result,

Print a block of code defined in f one step deeper from the current Indent.

Source

fn indented_if<F>(&mut self, guard: bool, f: F) -> Result
where F: FnMut(&mut Self) -> Result,

Same as IndentLike::indented, but the f only going to be printed in an indented context if guard is true.

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.

Implementors§