CBOR (Concise Binary Object Representation) data model and diagnostic notation.
This module defines CborItem, a lossless representation of any well-formed
CBOR encoding per RFC 8949.
How an integer value was encoded on the wire.
IW0 — inline in the additional info (values 0–23, 0 extra bytes)IW8 — 1-byte uint8 argumentIW16 — 2-byte uint16 argumentIW32 — 4-byte uint32 argumentIW64 — 8-byte uint64 argumentHow a float was encoded on the wire.
FW16 — IEEE 754 half-precision (2 bytes)FW32 — IEEE 754 single-precision (4 bytes)FW64 — IEEE 754 double-precision (8 bytes)How a simple value was encoded on the wire.
SW0 — inline in the additional info (values 0–19, 0 extra bytes)SW8 — 1-byte argument (values 32–255)Whether an array or map used definite or indefinite length encoding.
The sign of a CBOR integer, corresponding to the major type.
Positive — CBOR major type 0 (unsigned integer)Negative — CBOR major type 1 (negative integer, value = −1 − argument)CBOR semantic tags from the IANA registry.
Named variants for well-known tags. Unknown Int as the catch-all for
unrecognized tag numbers.
Convert an integer to its Tag representation.
Returns the named variant for well-known tag numbers, Unknown n otherwise.
Structured error returned by Cbor.Decode.decode.
InContext — a nested error with a context label and byte offset.OutOfBounds — the decoder ran past the end of the input.DecodingError — a CBOR-specific error at a byte offset.BadOneOf — all branches of a oneOf failed.CBOR-specific decoding error.
A lossless representation of a CBOR data item.
Round-tripping (decode → re-encode) preserves the exact original bytes. Encoding details (integer width, float precision, definite vs indefinite length) are captured for faithful diagnostic output.
The primary user-facing API is the combinator layer in
Cbor.EncodeandCbor.Decode. UseCborItemas an escape hatch for generic CBOR handling, diagnostics, and protocol debugging.