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§
Required Methods§
sourcefn load<P: AsRef<Path>>(&mut self, dir: P) -> Result<bool, String>
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 dataP: AsRef<Path>: type of the path- Output: a boolean or an error
sourcefn unload(&mut self, odir: Option<&Path>) -> Result<Self::Unfiled, String>
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; ifNone, nothing is saved- Output: unfiled data or error
Provided Methods§
Object Safety§
This trait is not object safe.