cratestack-codec-cbor
CBOR codec for CrateStack HTTP transport.
Overview
cratestack-codec-cbor is a single-type crate exposing CborCodec, a zero-state implementation of the CoolCodec trait built on minicbor-serde.
Installation
[]
= "0.2.2"
Usage
use CborCodec;
use CoolCodec;
let codec = CborCodec;
let bytes = codec.encode?;
let value: = codec.decode?;
assert_eq!;
With generated routes
let router = model_router;
With the Rust client
use ;
let base_url = parse?;
let client = new;
Notes
minicbor-serde reports is_human_readable() = true, which keeps wire compatibility for types whose serde implementations branch on that hint (uuid, chrono). The macro-emitted projection strips Value::Null map entries before reaching this codec, so the non-RFC-8949 "Null = empty array" quirk of this backend never lands on the wire.
The application/cbor-seq framing is reserved for streaming responses (CBOR_SEQUENCE_CONTENT_TYPE in cratestack-axum), but the codec itself does not implement a sequence decoder — generated routers currently emit single-item responses only.
See Also
- Transport Architecture
cratestack-codec-json— JSON codec
License
MIT