Skip to main content

Crate const_cbor_serde

Crate const_cbor_serde 

Source
Expand description

Serde support for const-cbor — a CBOR (RFC 8949) serde::Serializer / serde::Deserializer over the allocation-free core codec.

§Representation choices

RFC 8949 does not define a struct/enum mapping, so this crate follows the ecosystem conventions established by serde_cbor and ciborium for interoperability:

  • structs and maps serialize as CBOR maps keyed by field name,
  • enums are externally tagged: unit variants as bare text strings, other variants as one-entry maps { name: payload },
  • sequences serialize as indefinite-length arrays, maps as indefinite-length maps (the core encoder requires known lengths for definite forms),
  • Option::None/unit map to null,
  • char maps to a single-character text string.

The crate is no_std + alloc; it never allocates on the encode or decode path itself.

Structs§

Deserializer
Deserializes serde values from a borrowed CBOR input.
Serializer
Serializes serde values into a caller-provided fixed buffer.

Enums§

Error
A serialization or deserialization failure.

Functions§

from_slice
Deserializes a T from the complete CBOR input.
to_slice
Serializes value into buf, returning the number of bytes written.
to_vec
Serializes into a fresh Vec<u8> (alloc).