pub trait Deserialize: Size {
// Required method
fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
where Self: Sized;
// Provided method
fn tls_deserialize_exact(bytes: impl AsRef<[u8]>) -> Result<Self, Error>
where Self: Sized { ... }
}
Expand description
The Deserialize
trait defines functions to deserialize a byte slice to a
struct or enum.
Required Methods§
Sourcefn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>where
Self: Sized,
Available on crate feature std
only.
fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>where
Self: Sized,
std
only.This function deserializes the bytes
from the provided a std::io::Read
and returns the populated struct.
In order to get the amount of bytes read, use Size::tls_serialized_len
.
Returns an error if one occurs during deserialization.
Provided Methods§
Sourcefn tls_deserialize_exact(bytes: impl AsRef<[u8]>) -> Result<Self, Error>where
Self: Sized,
Available on crate feature std
only.
fn tls_deserialize_exact(bytes: impl AsRef<[u8]>) -> Result<Self, Error>where
Self: Sized,
std
only.This function deserializes the provided bytes
and returns the populated
struct. All bytes must be consumed.
Returns an error if not all bytes are read from the input, or if an error occurs during deserialization.
Implementations on Foreign Types§
Source§impl Deserialize for u8
impl Deserialize for u8
Source§impl Deserialize for u16
impl Deserialize for u16
Source§impl Deserialize for u32
impl Deserialize for u32
Source§impl Deserialize for u64
impl Deserialize for u64
Source§impl Deserialize for ()
impl Deserialize for ()
Source§impl<T> Deserialize for PhantomData<T>
impl<T> Deserialize for PhantomData<T>
Source§impl<T, U> Deserialize for (T, U)where
T: Deserialize,
U: Deserialize,
impl<T, U> Deserialize for (T, U)where
T: Deserialize,
U: Deserialize,
Source§impl<T, U, V> Deserialize for (T, U, V)
impl<T, U, V> Deserialize for (T, U, V)
Source§impl<T: Deserialize> Deserialize for Option<T>
impl<T: Deserialize> Deserialize for Option<T>
Source§impl<T: Deserialize> Deserialize for Vec<T>
Available on crate feature std
only.
impl<T: Deserialize> Deserialize for Vec<T>
Available on crate feature
std
only.Implementors§
impl Deserialize for SecretVLBytes
Available on crate feature
std
only.impl Deserialize for TlsByteVecU8
impl Deserialize for TlsByteVecU16
impl Deserialize for TlsByteVecU24
impl Deserialize for TlsByteVecU32
impl Deserialize for U24
impl Deserialize for VLBytes
Available on crate feature
std
only.