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§
- state
- CBOR State
- tagged
- A non exhaustive implementation of the most common tagged CBOR extension
- validate
- A CBOR validator for raw data
Structs§
- Array
- CBOR Array with references to elements
- Array
Builder - CBOR Array builder, when constructing
- Array
Owned - CBOR Array with owned elements
- Byte
- CBOR Byte value
- Bytes
Data - CBOR Bytestream reference to a chunk of byte
- Bytes
Data Owned - CBOR Bytestream owned chunk of byte
- Cbor
Data Of - A Validated CBOR slice of data containing the type T
- Cbor
Slice - A Validated CBOR slice of data
- Cbor
Slice Of - Decode
Error - Possible decode error when decoding an element
- Map
- CBOR Map with references to keys and values
- MapOwned
- CBOR Map with owned keys and values
- Negative
- CBOR Negative value
- Positive
- CBOR Positive value
- Reader
- CBOR Data structure to read CBOR elements from a slice of byte
- Tag
- CBOR Tag with reference to the tagged element
- TagOwned
- CBOR Tag with owned tagged element
- TagValue
- CBOR Tag Value in a Tag
- Text
Data - CBOR Text chunk with reference to the chunk of utf8 sequence
- Text
Data Owned - CBOR Text chunk with owned chunk of utf8 sequence
- Writer
- CBOR Data structure to write CBOR elements to a growing byte vector
Enums§
- Bytes
- CBOR Bytestream (indefinite and definite) with reference to the bytes
- Bytes
Owned - CBOR Bytestream (indefinite and definite) with owned bytes
- Constant
- CBOR constants (False/True/Null/Undefined)
- Data
- One CBOR Data element with references to the data
- Data
Owned - One CBOR Data element with owned data
- Decode
Error Kind - Possible errors when decoding an element
- Float
- CBOR Float (FP16, FP32, FP64)
- Reader
Error - Possible error when reading CBOR from a data stream
- Scalar
- Union type of CBOR Positive or Negative value
- Structure
Length - Text
- CBOR Text (UTF-8) (indefinite and definite) with reference to text chunk
- Text
Owned - CBOR Text (UTF-8) (indefinite and definite) with owned text chunk
- Type
- One of CBOR possible type
Traits§
- Decode
- Generic Decode trait to read an element T from the CBOR reader
- Encode
- Generic Encode trait to write an element T into the CBOR writer
Functions§
- decode_
from_ bytes - Try to decode bytes into T from its CBOR bytes representation
- decode_
vec - Decode zero to many Ts in an array
- encode_
to_ bytes - Encode an encodable type T into its CBOR bytes representation
- encode_
vec - 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