Function indent::indent_with
source · pub fn indent_with<'a, S, T>(prefix: S, input: T) -> String
Expand description
Indents every line that is not empty with the given prefix, starting from the second line.
The first line of the string is not indented so that it can be placed after an introduction sequence that has already begun the line.
§Examples
assert_eq!(format!("items:{}", indent::indent_with("- ", "\nfoo\nbar\n")),
"items:
- foo
- bar
")
For the version that also indents the first line, see indent_all_with.