pub trait Deserialize {
// Required method
fn read_from<T: Read + ReadBytesExt>(
reader: &mut T,
) -> Result<Self, SerializationError>
where Self: Sized;
}
Expand description
Deserialize
allows an item to be created from a binary representation.
Given that there are many different ways such a conversion may fail, this
operation will always yield a Result. It is not even sure that there
are enough bytes available to be read for the deserialization of this
item to completed successfully.
Required Methods§
Sourcefn read_from<T: Read + ReadBytesExt>(
reader: &mut T,
) -> Result<Self, SerializationError>where
Self: Sized,
fn read_from<T: Read + ReadBytesExt>(
reader: &mut T,
) -> Result<Self, SerializationError>where
Self: Sized,
Tries to read the data contained in reader
to create and instance of
Self
.
May return an error if the data did not match the expected format.