Trait Deserialize
pub trait Deserialize: Size {
// Required method
fn tls_deserialize<R>(bytes: &mut R) -> Result<Self, Error>
where R: Read,
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§
fn tls_deserialize<R>(bytes: &mut R) -> Result<Self, Error>
fn tls_deserialize<R>(bytes: &mut R) -> Result<Self, Error>
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§
fn tls_deserialize_exact(bytes: impl AsRef<[u8]>) -> Result<Self, Error>where
Self: Sized,
fn tls_deserialize_exact(bytes: impl AsRef<[u8]>) -> Result<Self, Error>where
Self: Sized,
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§
§impl Deserialize for &HpkePublicKey
Available on crate feature serialization only.
impl Deserialize for &HpkePublicKey
Available on crate feature
serialization only.§impl Deserialize for u8
impl Deserialize for u8
§impl Deserialize for u16
impl Deserialize for u16
§impl Deserialize for u32
impl Deserialize for u32
§impl Deserialize for u64
impl Deserialize for u64
§impl Deserialize for ()
impl Deserialize for ()
§impl Deserialize for HpkePublicKey
Available on crate feature serialization only.
impl Deserialize for HpkePublicKey
Available on crate feature
serialization only.