pub trait ToWriter: Sized {
// Required method
fn to_writer(&self, w: &mut impl Write) -> Result<()>;
// Provided method
fn write_to_file(self, path: &Path) -> Result<()> { ... }
}Expand description
Trait for data types that can be written to a writer.
Required Methods§
Provided Methods§
Sourcefn write_to_file(self, path: &Path) -> Result<()>
fn write_to_file(self, path: &Path) -> Result<()>
Writes self to a file at path in binary format.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.