Struct VLByteVec
pub struct VLByteVec { /* private fields */ }Expand description
Variable-length encoded byte vector.
Functionally equivalent to VLBytes, but its serde representation uses
serde_bytes to serialize the contained byte vector as a byte blob via
#[serde(transparent)]. This produces a much more compact encoding for
serde formats that distinguish byte arrays from sequences of u8 (e.g.
CBOR, MessagePack, bincode).
While the serde format produced by VLByteVec is not compatible with
the format produced by VLBytes, VLByteVec’s custom Deserialize impl
is backwards-compatible: it accepts both its own native bytes encoding and
the legacy VLBytes encoding (a struct with a vec field containing a
sequence of u8). This lets callers transparently migrate persisted
VLBytes data to VLByteVec for self-describing formats such as CBOR,
JSON or MessagePack.
Implementations§
Trait Implementations§
§impl Deserialize for VLByteVec
impl Deserialize for VLByteVec
§fn tls_deserialize<R>(bytes: &mut R) -> Result<VLByteVec, Error>where
R: Read,
fn tls_deserialize<R>(bytes: &mut R) -> Result<VLByteVec, Error>where
R: Read,
std only.bytes from the provided a std::io::Read
and returns the populated struct. Read more§impl<'de> Deserialize<'de> for VLByteVec
impl<'de> Deserialize<'de> for VLByteVec
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<VLByteVec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<VLByteVec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl DeserializeBytes for VLByteVec
impl DeserializeBytes for VLByteVec
impl Eq for VLByteVec
§impl Ord for VLByteVec
impl Ord for VLByteVec
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialOrd for VLByteVec
impl PartialOrd for VLByteVec
§impl Serialize for VLByteVec
impl Serialize for VLByteVec
§impl Serialize for &VLByteVec
impl Serialize for &VLByteVec
§impl Serialize for VLByteVec
impl Serialize for VLByteVec
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for VLByteVec
Auto Trait Implementations§
impl Freeze for VLByteVec
impl RefUnwindSafe for VLByteVec
impl Send for VLByteVec
impl Sync for VLByteVec
impl Unpin for VLByteVec
impl UnsafeUnpin for VLByteVec
impl UnwindSafe for VLByteVec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)