Skip to main content

impl_serialization

Macro impl_serialization 

Source
macro_rules! impl_serialization {
    ($type_name:ty, $model_type:expr, $type_str:expr) => { ... };
}
Expand description

Macro to generate ModelSave and ModelLoad implementations for a model type.

This macro eliminates the repetitive boilerplate of implementing the serialization traits. Each model type only needs to specify:

  • The type name
  • The ModelType variant
  • The type name string (for error messages)

§Example

impl_serialization!(MyModel, ModelType::MyModel, "MyModel");

This expands to full implementations of both ModelSave and ModelLoad.