Skip to main content

Module cbor

Module cbor 

Source

Modules§

bytes
Newtypes for &[u8], [u8;N] and Vec<u8>.
data
CBOR data types, tokens and tags.
decode
Traits and types for decoding CBOR.
encode
Traits and types for encoding CBOR.
lazy

Structs§

Any
Struct to hold arbitrary CBOR to be processed independently
Decoder
A non-allocating CBOR decoder.
Encoder
A non-allocating CBOR encoder writing encoded bytes to the given Write sink.
Tag
CBOR data item tag.

Enums§

IanaTag
IANA registered tags.
Type
CBOR data types.

Statics§

TAG_MAP_259
The IANA Tag 259: https://github.com/shanewholloway/js-cbor-codec/blob/master/docs/CBOR-259-spec--explicit-maps.md
TAG_SET_258
The IANA Tag 258: https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md

Traits§

CborLen
A type that can calculate its own CBOR encoding length.
Decode
A type that can be decoded from CBOR.
Encode
A type that can be encoded to CBOR.

Functions§

allow_tag
check_tagged_array_length
This function checks the size of an array containing a tagged value. The label parameter is used to identify which variant is being checked.
decode
Decode a type implementing Decode from the given byte slice.
decode_break
decode_with
Decode a type implementing Decode from the given byte slice.
display
Display the given CBOR bytes in diagnostic notation.
encode
Encode a type implementing Encode to the given encode::Write impl.
encode_with
Encode a type implementing Encode to the given encode::Write impl.
expect_tag
Decode a tagged value, expecting the given tag. For a lenient version, see allow_tag.
from_cbor
Decode raw bytes into a structured type T, assuming no context.
from_cbor_no_leftovers
Decode a CBOR input, ensuring that there are no bytes leftovers once decoded. This is handy to test standalone decoders and ensures that they entirely consume their inputs.
from_cbor_no_leftovers_with
Decode a CBOR input, ensuring that there are no bytes leftovers once decoded. This is handy to test standalone decoders and ensures that they entirely consume their inputs.
heterogeneous_array
Decode any heterogeneous CBOR array, irrespective of whether they’re indefinite or definite.
heterogeneous_map
Decode any heterogeneous CBOR map, irrespective of whether they’re indefinite or definite.
len
Calculate the length in bytes of the given value’s CBOR representation.
len_with
Calculate the length in bytes of the given value’s CBOR representation.
missing_field
Yield a PartialDecoder that fails with a comprehensible error message when an expected field is missing from the map.
tee
Decode a chunk, but retain a reference to the decoded bytes.
to_cbor
Encode any serialisable value T into bytes.
to_vec
Encode a type implementing Encode and return the encoded byte vector.
to_vec_with
Encode a type implementing Encode and return the encoded byte vector.
unexpected_field
Yield a Result<_, decode::Error> that always fails with a comprehensible error message when a map key is unexpected.

Derive Macros§

CborLen
Derive the minicbor::CborLen trait for a struct or enum.
Decode
Derive the minicbor::Decode trait for a struct or enum.
Encode
Derive the minicbor::Encode trait for a struct or enum.