timpl-internal 0.1.0-alpha.2

timpl internal. Only meant to be used by generated code. Use timpl instead.
Documentation
pub fn indent(indent: usize, str: String) -> String {
    let lines = str.split('\n').enumerate().peekable();
    let mut result = String::new();

    for (i, line) in lines {
        if i > 0 {
            result.push('\n');
        }

        if i == 0 || line.chars().all(char::is_whitespace) {
            result.push_str(line);
        } else {
            result.push_str(&" ".repeat(indent));
            result.push_str(line);
        }
    }

    result
}