pub fn format_tokens(tokens: &TokenStream) -> StringExpand description
Formats a token stream using rustfmt.
Returns the formatted code as a string. If rustfmt is not available or fails, returns the unformatted token stream as a string.
ยงExample
use quote::quote;
use clifford_codegen::codegen::format_tokens;
let tokens = quote! {
pub struct Foo { x: i32 }
};
let formatted = format_tokens(&tokens);
// formatted will be properly indented and spaced