Crate oasis_cbor

Crate oasis_cbor 

Source
Expand description

Convenience functions for dealing with CBOR encodings.

Re-exports§

pub use crate::decode::Decode;
pub use crate::encode::Encode;
pub use crate::encode::EncodeAsMap;

Modules§

decode
CBOR decoding.
encode
CBOR encoding.
reader
Functionality for deserializing CBOR data into values.
values
Types for expressing CBOR values.
writer
Functionality for serializing CBOR values into bytes.

Macros§

assert_sorted_keys
Assert that the keys in a vector of key-value pairs are in canonical order.
cbor_array
Creates a CBOR Value of type Array with the given elements.
cbor_array_vec
Creates a CBOR Value of type Array from a Vec.
cbor_bool
Creates a CBOR Value of type Simple with the given bool value.
cbor_bytes
Creates a CBOR Value of type Byte String with the given slice or vector.
cbor_bytes_lit
Creates a CBOR Value of type Byte String with the given byte string literal.
cbor_false
Creates a CBOR Value of type Simple with value false.
cbor_int
Creates a CBOR Value of type Unsigned or Negative with the given numeric value.
cbor_map
Creates a CBOR Value of type Map with the specified key-value pairs.
cbor_map_collection
Creates a CBOR Value of type Map from a Vec<(Value, Value)>.
cbor_map_options
Creates a CBOR Value of type Map with key-value pairs where values can be Options.
cbor_null
Creates a CBOR Value of type Simple with value null.
cbor_tagged
Creates a CBOR Value of type Tag with the given tag and object.
cbor_text
Creates a CBOR Value of type Text String with the given string.
cbor_true
Creates a CBOR Value of type Simple with value true.
cbor_undefined
Creates a CBOR Value of type Simple with the undefined value.
cbor_unsigned
Creates a CBOR Value of type Unsigned with the given numeric value.
destructure_cbor_map
This macro generates code to extract multiple values from a Vec<(Value, Value)> at once in an optimized manner, consuming the input vector.

Enums§

DecodeError
Error encountered during decoding.
SimpleValue
Specific simple CBOR values.
Value
Possible CBOR values.

Functions§

from_slice
Convert CBOR-encoded data into the given type.
from_slice_non_strict
Convert CBOR-encoded data into the given type using non-strict decoding.
from_value
Convert high-level CBOR representation into the given type.
read
Deserialize CBOR binary data to produce a single Value, expecting that there is no additional data. Maximum level of nesting supported is 127; more deeply nested structures will fail with DecoderError::TooMuchNesting.
to_value
Convert the given type into its high-level CBOR representation.
to_vec
Convert the given type into its CBOR-encoded representation.
write
Convert a Value to serialized CBOR data, consuming it along the way and appending to the provided vector. Maximum level of nesting supported is 127; more deeply nested structures will fail with EncoderError::TooMuchNesting.

Derive Macros§

Decode
Derives the Decode trait.
Encode
Derives the Encode trait.