Trait silx_core::utils::Filable

source ·
pub trait Filable {
    type Unfiled;

    // Required methods
    fn load<P: AsRef<Path>>(&mut self, dir: P) -> Result<bool, String>;
    fn unload(&mut self, odir: Option<&Path>) -> Result<Self::Unfiled, String>;

    // Provided method
    fn unwrap(self) -> Result<Self::Unfiled, String>
       where Self: Sized { ... }
}
Expand description

Properties of a type containing a variable data structure partially stored by means of several serialization files

Required Associated Types§

source

type Unfiled

Type of the unfiled data type

Required Methods§

source

fn load<P: AsRef<Path>>(&mut self, dir: P) -> Result<bool, String>

Load all missing data from files; bool indicates if already loaded (false) or not

  • dir: P : directory path from which is loaded the serialized files of missing data
  • P: AsRef<Path> : type of the path
  • Output: a boolean or an error
source

fn unload(&mut self, odir: Option<&Path>) -> Result<Self::Unfiled, String>

Optionally serialize all data on disk (filed data needs to be fully loaded) while unloading into the associated unfiled data type

  • odir: Option<&Path> : optional directory path where are saved the serialized files of all data; if None, nothing is saved
  • Output: unfiled data or error

Provided Methods§

source

fn unwrap(self) -> Result<Self::Unfiled, String>
where Self: Sized,

Unload all data (filed data needs to be fully loaded) into the associated unfiled data type

  • Output: unfiled data or error

Object Safety§

This trait is not object safe.

Implementors§