Function clang_format::clang_format_with_style
source · pub fn clang_format_with_style(
input: &str,
style: &ClangFormatStyle
) -> Result<String, impl Error>
Expand description
Execute clang-format with the given input, using the given style, and collect the output
Example
let input = r#"
struct Test {
};
"#;
let output = clang_format_with_style(input, &ClangFormatStyle::Mozilla);
assert!(output.is_ok());
assert_eq!(output.unwrap(), "\nstruct Test\n{};\n");