pub trait Formatter {
    fn format_str(&self, source: impl AsRef<str>) -> Result<String, Error>;

    fn format_file(&self, path: impl AsRef<Path>) -> Result<(), Error> { ... }
    fn format_tokens(&self, tokens: TokenStream) -> Result<String, Error> { ... }
}
Expand description

A unified interface to all formatters. It allows for formatting from string, file, or TokenStream (feature token_stream required)

Required methods

Format the given string and return the results in another String. An error is returned if any issues occur during formatting

Provided methods

Format the given file specified hte path and overwrite the file with the results. An error is returned if any issues occur during formatting

Format the given TokenStream and return the results in a String. An error is returned if any issues occur during formatting

Implementors