Module minicbor::bytes[][src]

Newtypes for &[u8] and Vec<u8>.

To support specialised encoding and decoding of byte slices and vectors, which are represented as CBOR bytes instead of arrays of u8s, the types ByteSlice and ByteVec (requires feature “std”) are provided. These implement Encode and Decode by translating to and from CBOR bytes.

If the feature “derive” is present, specialised traits EncodeBytes and DecodeBytes are also provided. These are implemented for the aforementioned newtypes as well as for their Option variations and regular &[u8] and Vec<u8>. They enable the direct use of &[u8] and Vec<u8> in types deriving Encode and Decode if used with a #[cbor(with = "minicbor::bytes")] annotation.

Structs

ByteSlice

Newtype for [u8].

ByteVec

Newtype for Vec<u8>.

Traits

DecodeBytes

Like Decode but specific for decoding from byte slices.

EncodeBytes

Like Encode but specific for encoding of byte slices.

Functions

decode

Freestanding function calling DecodeBytes::decode_bytes.

encode

Freestanding function calling EncodeBytes::encode_bytes.