Function
indent
(input: &str, prefix: &'static str)
Source from the content-addressed store, hash-verified
| 127 | } |
| 128 | |
| 129 | fn indent(input: &str, prefix: &'static str) -> String { |
| 130 | let mut output = String::new(); |
| 131 | let input = input.as_bytes(); |
| 132 | let input = BufReader::new(input); |
| 133 | for line_res in input.lines() { |
| 134 | let line = line_res.unwrap(); |
| 135 | if !line.is_empty() { |
| 136 | output.push_str(prefix); |
| 137 | output.push_str(&line); |
| 138 | } |
| 139 | output.push('\n'); |
| 140 | } |
| 141 | output |
| 142 | } |
| 143 | |
| 144 | #[cfg(test)] |
| 145 | mod tests { |
Tested by
no test coverage detected