pub enum DataItem {
Integer {
value: u64,
bitwidth: IntegerWidth,
},
Negative {
value: u64,
bitwidth: IntegerWidth,
},
ByteString(ByteString),
TextString(TextString),
IndefiniteByteString(Vec<ByteString>),
IndefiniteTextString(Vec<TextString>),
Array {
data: Vec<DataItem>,
bitwidth: Option<IntegerWidth>,
},
Map {
data: Vec<(DataItem, DataItem)>,
bitwidth: Option<IntegerWidth>,
},
Tag {
tag: Tag,
bitwidth: IntegerWidth,
value: Box<DataItem>,
},
Float {
value: f64,
bitwidth: FloatWidth,
},
Simple(Simple),
}
Expand description
A CBOR data item.
Variants§
Integer
Fields
bitwidth: IntegerWidth
The bitwidth used for encoding this integer.
An unsigned integer.
Negative
Fields
value: u64
The encoded value of this negative integer, the real value is -1 - value
(requires use of i128
for full range support).
bitwidth: IntegerWidth
The bitwidth used for encoding this integer.
A negative integer.
ByteString(ByteString)
A string of raw bytes with no direct attached meaning.
See the docs for ByteString
for more details.
TextString(TextString)
A UTF-8 encoded text string.
See the docs for TextString
for more details.
IndefiniteByteString(Vec<ByteString>)
A series of ByteString
chunks encoded as an indefinite length byte
string.
See RFC 7049 § 2.2.2.
IndefiniteTextString(Vec<TextString>)
A series of TextString
chunks encoded as an indefinite length text
string.
See RFC 7049 § 2.2.2.
Array
Fields
bitwidth: Option<IntegerWidth>
The bitwidth used for encoding the array length.
If has the value None
then this array is encoded using the
indefinite length form, see RFC 7049 § 2.2.1.
An array of data items.
Map
Fields
bitwidth: Option<IntegerWidth>
The bitwidth used for encoding the map length.
If has the value None
then this map is encoded using the
indefinite length form, see RFC 7049 § 2.2.1.
A map of pairs of data items.
Tag
Fields
bitwidth: IntegerWidth
The bitwidth used to encode the semantic tag.
Semantic tagging of another data item.
See the docs for Tag
for more details.
Float
Fields
bitwidth: FloatWidth
The bitwidth used for encoding the value.
A floating point value.
See RFC 7049 § 2.3.
Simple(Simple)
A “simple value” data item.
See the docs for Simple
for more details.