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§
Sourcefn from_reader(r: impl Read) -> Result<Self>
fn from_reader(r: impl Read) -> Result<Self>
Reads in an instance of Self
.
Provided Methods§
Sourcefn read_from_file(path: &Path) -> Result<Self>
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.