Trait lebe::io::ReadEndian
source · pub trait ReadEndian<T: ?Sized> {
// Required methods
fn read_from_little_endian_into(&mut self, value: &mut T) -> Result<()>;
fn read_from_big_endian_into(&mut self, value: &mut T) -> Result<()>;
// Provided methods
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<()> { ... }
fn read_from_little_endian(&mut self) -> Result<T>
where T: Sized + Default { ... }
fn read_from_big_endian(&mut self) -> Result<T>
where T: Sized + Default { ... }
fn read_from_native_endian(&mut self) -> Result<T>
where T: Sized + Default { ... }
}
Expand description
A std::io::Read
input stream which supports reading any primitive values from bytes.
Will decode the values from either little endian or big endian, as desired.
This extension trait is implemented for all Read
types.
Add use lebe::io::ReadEndian;
to your code
to automatically unlock this functionality for all types that implement Read
.
Required Methods§
sourcefn read_from_little_endian_into(&mut self, value: &mut T) -> Result<()>
fn read_from_little_endian_into(&mut self, value: &mut T) -> Result<()>
Read into the supplied reference. Acts the same as std::io::Read::read_exact
.
sourcefn read_from_big_endian_into(&mut self, value: &mut T) -> Result<()>
fn read_from_big_endian_into(&mut self, value: &mut T) -> Result<()>
Read into the supplied reference. Acts the same as std::io::Read::read_exact
.
Provided Methods§
sourcefn read_from_native_endian_into(&mut self, value: &mut T) -> Result<()>
fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<()>
Read into the supplied reference. Acts the same as std::io::Read::read_exact
.
sourcefn read_from_little_endian(&mut self) -> Result<T>where
T: Sized + Default,
fn read_from_little_endian(&mut self) -> Result<T>where T: Sized + Default,
Read the byte value of the inferred type
sourcefn read_from_big_endian(&mut self) -> Result<T>where
T: Sized + Default,
fn read_from_big_endian(&mut self) -> Result<T>where T: Sized + Default,
Read the byte value of the inferred type
sourcefn read_from_native_endian(&mut self) -> Result<T>where
T: Sized + Default,
fn read_from_native_endian(&mut self) -> Result<T>where T: Sized + Default,
Read the byte value of the inferred type