Trait lebe::io::WriteEndian

source ·
pub trait WriteEndian<T: ?Sized> {
    // Required methods
    fn write_as_little_endian(&mut self, value: &T) -> Result<()>;
    fn write_as_big_endian(&mut self, value: &T) -> Result<()>;

    // Provided method
    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§

source

fn write_as_little_endian(&mut self, value: &T) -> Result<()>

Write the byte value of the specified reference, converting it to little endianness

source

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§

source

fn write_as_native_endian(&mut self, value: &T) -> Result<()>

Write the byte value of the specified reference, not converting it

Implementors§

source§

impl<W: Write> WriteEndian<f32> for W

source§

impl<W: Write> WriteEndian<f64> for W

source§

impl<W: Write> WriteEndian<i8> for W

source§

impl<W: Write> WriteEndian<i16> for W

source§

impl<W: Write> WriteEndian<i32> for W

source§

impl<W: Write> WriteEndian<i64> for W

source§

impl<W: Write> WriteEndian<i128> for W

source§

impl<W: Write> WriteEndian<u8> for W

source§

impl<W: Write> WriteEndian<u16> for W

source§

impl<W: Write> WriteEndian<u32> for W

source§

impl<W: Write> WriteEndian<u64> for W

source§

impl<W: Write> WriteEndian<u128> for W

source§

impl<W: Write> WriteEndian<[f32]> for W

source§

impl<W: Write> WriteEndian<[f64]> for W

source§

impl<W: Write> WriteEndian<[i8]> for W

source§

impl<W: Write> WriteEndian<[i16]> for W

source§

impl<W: Write> WriteEndian<[i32]> for W

source§

impl<W: Write> WriteEndian<[i64]> for W

source§

impl<W: Write> WriteEndian<[i128]> for W

source§

impl<W: Write> WriteEndian<[u8]> for W

source§

impl<W: Write> WriteEndian<[u16]> for W

source§

impl<W: Write> WriteEndian<[u32]> for W

source§

impl<W: Write> WriteEndian<[u64]> for W

source§

impl<W: Write> WriteEndian<[u128]> for W