native_model

Attribute Macro native_model

Source
#[native_model]
Expand description

Macro which add identity and version to your rust type.

Attributes:

  • id = u32: The unique identifier of the model.
  • version = u32: The version of the model.
  • with = type: Required, the serialization/deserialization library that you use. Must implement native_model::Encode and native_model::Decode.
  • from = type: Optional, the previous version of the model.
    • type: The previous version of the model that you use for the From implementation.
  • try_from = (type, error): Optional, the previous version of the model with error handling.
    • type: The previous version of the model that you use for the TryFrom implementation.
    • error: The error type that you use for the TryFrom implementation.

See examples: