Expand description
Newtypes for &[u8]
, [u8;N]
and Vec<u8>
.
To support specialised encoding and decoding of byte slices, byte arrays,
and vectors which are represented as CBOR bytes instead of arrays of u8
s,
the types ByteSlice
, ByteArray
and ByteVec
(requires feature “alloc”)
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, regular
&[u8]
, [u8; N]
, Vec<u8>
and for Cow<'_, [u8]>
if the alloc feature
is given. They enable the direct use of &[u8]
, [u8; N]
, Vec<u8>
and
Cow<'_, [u8]>
in types deriving Encode
and Decode
if used with a
#[cbor(with = "minicbor::bytes")]
annotation.
Structs§
- Newtype for
[u8; N]
. - Newtype for
[u8]
.
Traits§
- Like
CborLen
but specific for byte slices. - Like
Decode
but specific for decoding from byte slices. - Like
Encode
but specific for encoding of byte slices.
Functions§
- Freestanding function calling
DecodeBytes::decode_bytes
. - Freestanding function calling
EncodeBytes::encode_bytes
.