Macro textwrap_macros::indent [−][src]
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
ⓘ
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.