Trait lebe::io::WriteEndian
source · [−]pub trait WriteEndian<T: ?Sized> {
fn write_as_little_endian(&mut self, value: &T) -> Result<()>;
fn write_as_big_endian(&mut self, value: &T) -> Result<()>;
fn write_as_native_endian(&mut self, value: &T) -> Result<()> { ... }
}
Expand description
A std::io::Write
output stream which supports writing any primitive values as bytes.
Will encode the values to be either little endian or big endian, as desired.
This extension trait is implemented for all Write
types.
Add use lebe::io::WriteEndian;
to your code
to automatically unlock this functionality for all types that implement Write
.
Required Methods
fn write_as_little_endian(&mut self, value: &T) -> Result<()>
fn write_as_little_endian(&mut self, value: &T) -> Result<()>
Write the byte value of the specified reference, converting it to little endianness
fn write_as_big_endian(&mut self, value: &T) -> Result<()>
fn write_as_big_endian(&mut self, value: &T) -> Result<()>
Write the byte value of the specified reference, converting it to big endianness
Provided Methods
fn write_as_native_endian(&mut self, value: &T) -> Result<()>
fn write_as_native_endian(&mut self, value: &T) -> Result<()>
Write the byte value of the specified reference, not converting it