pub struct ModelSerializer { /* private fields */ }Expand description
Re-exported serialization utilities.
This includes model persistence with versioning, metadata tracking, and support for multiple serialization formats. Main serializer with configurable format and compression.
Provides a unified interface for saving and loading models with consistent error handling and metadata management.
Implementations§
Source§impl ModelSerializer
impl ModelSerializer
Sourcepub fn with_compression(self, compression: bool) -> Self
pub fn with_compression(self, compression: bool) -> Self
Sourcepub fn with_format(self, format: SerializationFormat) -> Self
pub fn with_format(self, format: SerializationFormat) -> Self
Sets the serialization format.
§Arguments
format-SerializationFormatto use
§Returns
Self with updated format (builder pattern)
Sourcepub fn save_model<T: Serialize>(
&self,
model: &T,
metadata: &ModelMetadata,
path: &Path,
) -> SerializationResult<()>
pub fn save_model<T: Serialize>( &self, model: &T, metadata: &ModelMetadata, path: &Path, ) -> SerializationResult<()>
Saves a model to disk with metadata.
Automatically creates parent directories if they don’t exist.
§Arguments
model- Model to serialize (must implementSerialize)metadata- Model metadatapath- Destination file path
§Returns
Ok(()) on success, SerializationError on failure
Sourcepub fn load_model<T: DeserializeOwned>(
&self,
path: &Path,
) -> SerializationResult<(T, ModelMetadata)>
pub fn load_model<T: DeserializeOwned>( &self, path: &Path, ) -> SerializationResult<(T, ModelMetadata)>
Sourcepub fn validate_model_file(
&self,
path: &Path,
) -> SerializationResult<ModelMetadata>
pub fn validate_model_file( &self, path: &Path, ) -> SerializationResult<ModelMetadata>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelSerializer
impl RefUnwindSafe for ModelSerializer
impl Send for ModelSerializer
impl Sync for ModelSerializer
impl Unpin for ModelSerializer
impl UnwindSafe for ModelSerializer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more