Trait eio::WriteExt[][src]

pub trait WriteExt<const N: usize>: Write {
    fn write_be<T: ToBytes<N>>(&mut self, t: T) -> Result<()> { ... }
fn write_le<T: ToBytes<N>>(&mut self, t: T) -> Result<()> { ... } }

Provides extended methods to types that implement std::io::Write.

Provided methods

fn write_be<T: ToBytes<N>>(&mut self, t: T) -> Result<()>[src]

Write T to the destination in big endian order.

Examples

use eio::WriteExt;

let mut w = Vec::new();
w.write_be(0x12345678).unwrap();
assert_eq!(w, &[0x12, 0x34, 0x56, 0x78]);

fn write_le<T: ToBytes<N>>(&mut self, t: T) -> Result<()>[src]

Write T to the destination in little endian order.

Examples

use eio::WriteExt;

let mut w = Vec::new();
w.write_le(0x12345678).unwrap();
assert_eq!(w, &[0x78, 0x56, 0x34, 0x12]);
Loading content...

Implementors

impl<W, const N: usize> WriteExt<N> for W where
    W: Write
[src]

Loading content...