pub trait Formatter {
// Required method
fn write_to(&self, writer: &mut dyn Write) -> Result<()>;
// Provided methods
fn write_to_file(&self, path: &Path) -> Result<()> { ... }
fn read(&self) -> Result<Vec<u8>> { ... }
}pub trait Formatter {
// Required method
fn write_to(&self, writer: &mut dyn Write) -> Result<()>;
// Provided methods
fn write_to_file(&self, path: &Path) -> Result<()> { ... }
fn read(&self) -> Result<Vec<u8>> { ... }
}