Function clang_format::clang_format [−][src]
pub fn clang_format(input: &str) -> Result<String, ClangFormatError>Expand description
Execute clang-format with the given input and collect the output
Example
CLANG_FORMAT_STYLE.set(ClangFormatStyle::Mozilla);
let input = r#"
struct Test {
};
"#;
let output = clang_format(input);
assert!(output.is_ok());
assert_eq!(output.unwrap(), "\nstruct Test\n{};\n");