pub trait RawData: Sized {
// Required methods
fn read_raw(path: impl AsRef<Path>) -> Option<Self>;
fn write_raw(&self, path: &str) -> Result<(), DataError>;
}Required Methods§
Sourcefn read_raw(path: impl AsRef<Path>) -> Option<Self>
fn read_raw(path: impl AsRef<Path>) -> Option<Self>
Attempts to read raw data from a specified path and instantiate an object.
§Arguments
path- A reference to a path from which to read the raw data. It can be any type that implementsAsRef<Path>, such asStringorPath.
§Returns
Returns an Option<Self>, which will be Some(Self) if reading and parsing are successful,
or None if an error occurs or the data is not available.
Sourcefn write_raw(&self, path: &str) -> Result<(), DataError>
fn write_raw(&self, path: &str) -> Result<(), DataError>
Attempts to write the raw data to a specified path.
§Arguments
&self- The instance of the type implementingRawData.path- A string slice specifying the path where the raw data will be written.
§Returns
Returns a Result<(), DataError>, indicating success with Ok(()) or an error
of type DataError if writing fails.
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.