opentitanlib::util::file

Trait FromReader

Source
pub trait FromReader: Sized {
    // Required method
    fn from_reader(r: impl Read) -> Result<Self>;

    // Provided method
    fn read_from_file(path: &Path) -> Result<Self> { ... }
}
Expand description

Trait for data types that can be streamed to a reader.

Required Methods§

Source

fn from_reader(r: impl Read) -> Result<Self>

Reads in an instance of Self.

Provided Methods§

Source

fn read_from_file(path: &Path) -> Result<Self>

Reads an instance of Self from a binary file at path.

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§