Function indent::indent_all_with

source ·
pub fn indent_all_with<'a, S, T>(prefix: S, input: T) -> String
where S: Into<Cow<'a, str>>, T: Into<Cow<'a, str>>,
Expand description

Indents every line that is not empty with the given prefix.

§Examples

assert_eq!(format!("items:\n{}", indent::indent_all_with("- ", "foo\nbar\n")),
"items:
- foo
- bar
")

For the version that also indents the first line, see indent_with.