Crate native_model

Source
Expand description

native_model is a Rust crate that acts as a thin wrapper around serialized data, adding identity and version information.

  • It aims to ensure:
    • Interoperability: Different applications can work together even if they use different data model versions.
    • Data Consistency: Ensures the data is processed as expected.
    • Flexibility: Allows the use of any serialization format. Mode details here.
    • Minimal Performance Overhead: Current performance has a minimal overhead see performance section.
  • Suitability:
    • Suitable for applications that are written in Rust, evolve independently, store data locally, and require incremental upgrades.
    • Not suitable for non-Rust applications, systems not controlled by the user, or when human-readable formats are needed.
  • Setup:
    • Users must define their own serialization format and data model. Mode details here.
  • Development Stage:
    • The crate is in early development, and performance is expected to improve over time.

See examples in the README.md file.

Modules§

bincode_1_3
bincode 1.3 · The default codec for serializing & deserializing.
bincode_2_rc
bincode 2.0.0-rc.3 · Enable the bincode_2_rc feature and annotate your type with native_model::bincode_2_rc::Bincode to have native_db use this crate for serializing & deserializing.
postcard_1_0
postcard 1.0 · Enable the postcard_1_0 feature and annotate your type with native_model::postcard_1_0::PostCard to have native_db use this crate.
rmp_serde_1_3
rmp-serde 1.3 · Enable the rmp_serde_1_3 feature and annotate your type with native_model::rmp_serde_1_3::RmpSerde or native_model::rmp_serde_1_3::RmpSerdeNamed to have native_db use this crate.
wrapper

Structs§

DowngradeError
EncodeBodyError
UpgradeError

Enums§

DecodeBodyError
Error

Traits§

Decode
Decode trait for your own decoding method.
Encode
Encode trait for your own encoding method.
Model

Functions§

decode
Allows to decode a native_model from a Vec<u8> and returns the version (u32). See examples:
encode
Allows to encode a native_model into a Vec<u8>.
encode_downgrade
Allows to encode a native_model into a Vec<u8> with a specific version. See examples:

Type Aliases§

DecodeResult
EncodeResult
Result

Attribute Macros§

native_model
Macro which add identity and version to your rust type.