Skip to main content

Formatter

Trait Formatter 

Source
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§

Source

fn write_class(&self, class: &Class, output: &mut dyn Write) -> Result

Writes class to output.

§Errors

Returns std::fmt::Error when output rejects a write.

Provided Methods§

Source

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".

Implementors§