Trait nuts_bytes::FromBytes
source · pub trait FromByteswhere
Self: Sized,{
// Required method
fn from_bytes<TB: TakeBytes>(source: &mut TB) -> Result<Self, Error>;
}
Expand description
Trait that supports reading datatypes from a binary data stream.
Datatypes that implements this trait can be read from a binary data stream.
Required Methods§
sourcefn from_bytes<TB: TakeBytes>(source: &mut TB) -> Result<Self, Error>
fn from_bytes<TB: TakeBytes>(source: &mut TB) -> Result<Self, Error>
Reads data from the given source
.
Reads as much as necessary from source
. The method deserializes the
instance and returns it.
Errors
If not enough data are available in source
, the
TakeBytes::take_bytes()
call returns a
TakeBytesError::Eof
error, which should be simply forwarded.
Object Safety§
This trait is not object safe.