Trait FromBytes

Source
pub trait FromBytes: Sized {
    // Required method
    fn from_bytes(reader: &mut dyn BufRead) -> Result<Self, Error>;
}
Expand description

FromBytes indicates that the type can be directly translated from a byte-oriented format. This is primarily used for types that represent structures used in a wire format.

Required Methods§

Source

fn from_bytes(reader: &mut dyn BufRead) -> Result<Self, Error>

Read an instance of this type from the reader.

If successful, an instance of this type is returned and the reader now points to the byte immediately following the returned object. If an error occurs, the error is returned and reader is left in an indeterminate state.

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.

Implementors§