Skip to main content

RawData

Trait RawData 

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

Source

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 implements AsRef<Path>, such as String or Path.
§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.

Source

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 implementing RawData.
  • 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.

Implementors§