pub trait BufferDeserializer: Sized {
// Required method
fn deserialize(buf: &[u8]) -> Result<(Self, usize)>;
}
Expand description
A trait for deserializing objects from a octet buffer.
Required Methods§
Sourcefn deserialize(buf: &[u8]) -> Result<(Self, usize)>
fn deserialize(buf: &[u8]) -> Result<(Self, usize)>
Deserializes an instance of Self
from the given octet buffer.
§Parameters
buf
: A octet slice that contains the serialized data.
§Returns
This method returns a Result<Self>
, which is:
Ok((Self, usize))
on successful deserialization, where theusize
indicates the number of octets consumed.Err(io::Error)
if deserialization fails, which could be due to invalid data or unexpected format.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.