opentitanlib::util::file

Trait ToWriter

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

Source

fn to_writer(&self, w: &mut impl Write) -> Result<()>

Writes out self.

Provided Methods§

Source

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.

Implementors§