Skip to main content

Linkable

Derive Macro Linkable 

Source
#[derive(Linkable)]
Expand description

Derive Linkable (JSON codec) for a schema type.

Emits from_bytes/to_bytes via serde_json::from_slice/to_vec — the boilerplate every hand-written impl Linkable for a JSON-wire type repeats. Requires T: Serialize + DeserializeOwned (a normal compile error surfaces if it’s missing) and the linkable-json feature of aimdb-data-contracts (for the Linkable trait and its __private::serde_json re-export). Binary formats (e.g. KNX DPT codecs) still implement Linkable by hand — this derive is JSON-only.

§Example

Illustrative (not compiled: see the crate-level note — compiled integration tests live in aimdb-data-contracts).

ⓘ
use aimdb_data_contracts::Linkable;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Serialize, Deserialize, Linkable)]
struct Temperature {
    celsius: f32,
    timestamp: u64,
}