Expand description

CBOR exact reader and writer

use cbored::Reader;
let mut reader = Reader::new(&[0x80]);
let array = reader.array().expect("valid array");
assert_eq!(array.len(), 0);
use cbored::{Writer, StructureLength, Positive};
let mut writer = Writer::new();
writer.array_build(StructureLength::Indefinite, |writer| {
    writer.positive(Positive::canonical(10));
})

Modules

CBOR State

A non exhaustive implementation of the most common tagged CBOR extension

A CBOR validator for raw data

Structs

CBOR Array with references to elements

CBOR Array builder, when constructing

CBOR Array with owned elements

CBOR Byte value

CBOR Bytestream reference to a chunk of byte

CBOR Bytestream owned chunk of byte

A Validated CBOR slice of data containing the type T

Possible decode error when decoding an element

CBOR Map with references to keys and values

CBOR Map with owned keys and values

CBOR Negative value

CBOR Positive value

CBOR Data structure to read CBOR elements from a slice of byte

CBOR Tag with reference to the tagged element

CBOR Tag with owned tagged element

CBOR Tag Value in a Tag

CBOR Text chunk with reference to the chunk of utf8 sequence

CBOR Text chunk with owned chunk of utf8 sequence

CBOR Data structure to write CBOR elements to a growing byte vector

Enums

CBOR Bytestream (indefinite and definite) with reference to the bytes

CBOR Bytestream (indefinite and definite) with owned bytes

CBOR constants (False/True/Null/Undefined)

One CBOR Data element with references to the data

One CBOR Data element with owned data

Possible errors when decoding an element

CBOR Float (FP16, FP32, FP64)

Possible error when reading CBOR from a data stream

Union type of CBOR Positive or Negative value

CBOR Text (UTF-8) (indefinite and definite) with reference to text chunk

CBOR Text (UTF-8) (indefinite and definite) with owned text chunk

One of CBOR possible type

Traits

Generic Decode trait to read an element T from the CBOR reader

Generic Encode trait to write an element T into the CBOR writer

Functions

Try to decode bytes into T from its CBOR bytes representation

Decode zero to many Ts in an array

Encode an encodable type T into its CBOR bytes representation

Encode a slice of Ts, as a CBOR array of definite length and each element written with the encode method for each T value sequentially