Skip to main content

Crate zerocbor_derive

Crate zerocbor_derive 

Source
Expand description

Derive macros for zerocbor.

c_enum requires a fieldless enum and an integer representation:

โ“˜
#[derive(zerocbor_derive::ToCbor)]
#[cbor(c_enum)]
enum Data { Value(u8) }
โ“˜
#[derive(zerocbor_derive::FromCbor)]
#[cbor(c_enum, map)]
enum Names { First }

Tags on a c_enum apply to the whole enum, not individual variants:

โ“˜
#[derive(zerocbor_derive::FromCbor)]
#[cbor(c_enum)]
enum Tagged { #[cbor(tag = 42)] First }

Derive Macrosยง

FromCbor
Derives zerocbor::FromCbor. See the crate-level docs for the attributes.
ToCbor
Derives zerocbor::ToCbor. See the crate-level docs for the attributes.