[][src]Macro textwrap_macros::indent

macro_rules! indent {
    #[proc_macro_hack::proc_macro_hack] => { ... };
}

Add prefix to each non-empty line.

Empty lines (consisting only of whitespaces, with respect to char.is_whitespace) are not indented but replaced by a single newline character \n. Leading and trailing whitespace on non-empty lines is kept unchanged.

Usage

This example is not tested
indent!($text: lit &str, $prefix: lit &str) -> lit &str

Example

use textwrap_macros::indent;

const Y: &str = indent!("
Foo
Bar
", "-> ");

assert_eq!(Y, "
-> Foo
-> Bar
");

See also textwrap::indent.