Expand description
Wrapper types to enable optimized handling of [u8; N]
, &[u8]
and Vec<u8>
.
This crate is a fork of serde_bytes
that adds
support for [u8; N]
and &[u8; N]
.
#[derive(Deserialize, Serialize)]
struct Efficient<'a> {
#[serde(with = "serde_bytes_ng")]
bytes: &'a [u8],
#[serde(with = "serde_bytes_ng")]
byte_buf: Vec<u8>,
#[serde(with = "serde_bytes_ng")]
byte_array: [u8; 188],
#[serde(with = "serde_bytes_ng", borrow)]
byte_array_ref: &'a [u8; 188],
}
Structs§
- ByteBuf
- Wrapper around
Vec<u8>
to serialize and deserialize efficiently. - Bytes
- Wrapper around
[u8]
to serialize and deserialize efficiently.
Traits§
- Deserialize
- Types that can be deserialized via
#[serde(with = "serde_bytes_ng")]
. - Serialize
- Types that can be serialized via
#[serde(with = "serde_bytes_ng")]
.
Functions§
- deserialize
- Serde
deserialize_with
function to deserialize bytes efficiently. - serialize
- Serde
serialize_with
function to serialize bytes efficiently.