Skip to main content

NsonSerialize

Derive Macro NsonSerialize 

Source
#[derive(NsonSerialize)]
{
    // Attributes available to this derive:
    #[njson]
    #[nextjson]
    #[serde]
}
Available on crate feature derive only.
Expand description

Re-exports nextjson’s format-neutral serialization contracts.

NsonSerialize and NsonDeserialize are both traits and derive macros, so #[derive(rustbinary::NsonSerialize, rustbinary::NsonDeserialize)] works. Generated code refers to the ::nextjson crate, so applications must also depend on nextjson (the framework this codec is built on). Derive NextJson’s native serialization contract and compile-time schema.

Configuration is accepted through #[njson(...)] (and, for migration convenience, #[serde(...)]). The generated implementation writes directly through NsonSerialize::nextencode and exposes NsonSchema::SCHEMA without depending on another macro framework.