ModelSerialization

Trait ModelSerialization 

Source
pub trait ModelSerialization {
    // Required methods
    fn serialize(&self, format: ModelFormat) -> Result<Vec<u8>, SklearsError>;
    fn deserialize(
        data: &[u8],
        format: ModelFormat,
    ) -> Result<Self, SklearsError>
       where Self: Sized;
    fn supported_formats() -> Vec<ModelFormat>;
}
Expand description

Generic model serialization interface

Required Methods§

Source

fn serialize(&self, format: ModelFormat) -> Result<Vec<u8>, SklearsError>

Serialize model to bytes in specified format

Source

fn deserialize(data: &[u8], format: ModelFormat) -> Result<Self, SklearsError>
where Self: Sized,

Deserialize model from bytes

Source

fn supported_formats() -> Vec<ModelFormat>

Get supported formats for this model type

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§