MCPcopy Create free account
hub / github.com/bitfield/up2code / indent

Function indent

src/lib.rs:129–142  ·  view source on GitHub ↗
(input: &str, prefix: &'static str)

Source from the content-addressed store, hash-verified

127}
128
129fn 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)]
145mod tests {

Callers 1

diffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected