Skip to main content

TextCodec

Trait TextCodec 

Source
pub trait TextCodec {
    type Options: Default;

    // Required methods
    fn serialize(model: &Model, options: &Self::Options) -> Result<String>;
    fn deserialize(source: &str) -> Result<Model>;
}
Expand description

A textual serialization format for Model.

Binary protobuf file I/O remains separate because it also manages paths, external weights, and file-format detection.

Required Associated Types§

Source

type Options: Default

Format-specific serialization options.

Required Methods§

Source

fn serialize(model: &Model, options: &Self::Options) -> Result<String>

Serialize model with explicit format options.

Source

fn deserialize(source: &str) -> Result<Model>

Deserialize a model from this format.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§