pub trait DataFormat {
// Required methods
fn read_from<T: Data, R: Read + BufRead>(rdr: R) -> Result<T>;
fn write_to<T: Serialize, W: Write>(data: &T, wtr: W) -> Result<()>;
// Provided methods
fn read_from_file<T: Data>(path: &Path) -> Result<T> { ... }
fn write_to_file<T: Serialize>(data: &T, path: &Path) -> Result<()> { ... }
}Expand description
Data format to read and load data from a file
Required Methods§
Provided Methods§
Sourcefn read_from_file<T: Data>(path: &Path) -> Result<T>
fn read_from_file<T: Data>(path: &Path) -> Result<T>
Read data from a file
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.