extern crate indented; use indented::{indented_with, Tab}; fn main() { let x = "statement"; // You can use the zero-sized Tab struct let y = format!("nested {{\n{};\n}}", indented_with(x, Tab)); // Or just use the character, or even the static str equivalent println!("block {{\n{};\n{}\n}}", indented_with(x, '\t'), indented_with(&y, "\t")); }