Skip to main content

PersistentModel

Trait PersistentModel 

Source
pub trait PersistentModel {
    // Required methods
    fn save<P: AsRef<Path>>(
        &self,
        path: P,
        metadata: ModelMetadata,
    ) -> Result<(), PersistenceError>;
    fn load<P: AsRef<Path>>(
        path: P,
    ) -> Result<(Self, ModelMetadata), PersistenceError>
       where Self: Sized;
}
Expand description

Convenience trait for easy model saving/loading

Required Methods§

Source

fn save<P: AsRef<Path>>( &self, path: P, metadata: ModelMetadata, ) -> Result<(), PersistenceError>

Save model to file (format determined by file extension)

Source

fn load<P: AsRef<Path>>( path: P, ) -> Result<(Self, ModelMetadata), PersistenceError>
where Self: Sized,

Load model from file (format determined by file extension)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§