pub trait ModelSerialization {
// Required methods
fn serialize(&self, format: ModelFormat) -> Result<Vec<u8>>;
fn deserialize(data: &[u8], format: ModelFormat) -> Result<Self>
where Self: Sized;
fn supported_formats() -> Vec<ModelFormat>;
}Expand description
Generic model serialization interface
Required Methods§
Sourcefn serialize(&self, format: ModelFormat) -> Result<Vec<u8>>
fn serialize(&self, format: ModelFormat) -> Result<Vec<u8>>
Serialize model to bytes in specified format
Sourcefn deserialize(data: &[u8], format: ModelFormat) -> Result<Self>where
Self: Sized,
fn deserialize(data: &[u8], format: ModelFormat) -> Result<Self>where
Self: Sized,
Deserialize model from bytes
Sourcefn supported_formats() -> Vec<ModelFormat>
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.