pub trait Formatter {
// Required method
fn write_class(&self, class: &Class, output: &mut dyn Write) -> Result;
// Provided method
fn format(&self, class: &Class) -> Result<String, FerroBabeError> { ... }
}Expand description
Renders a complete class model into text.
Implement this trait when a consumer needs a presentation other than the compact
reverse-engineering output produced by FerroFormatter. Implementations receive only a
complete Class; partial disassemblies must be handled by the caller.
Required Methods§
Sourcefn write_class(&self, class: &Class, output: &mut dyn Write) -> Result
fn write_class(&self, class: &Class, output: &mut dyn Write) -> Result
Provided Methods§
Sourcefn format(&self, class: &Class) -> Result<String, FerroBabeError>
fn format(&self, class: &Class) -> Result<String, FerroBabeError>
Renders class into a newly allocated string.
§Errors
Returns FerroBabeError::Format when Self::write_class cannot write to the string
destination.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".