Trait bytestream::StreamReader[][src]

pub trait StreamReader: Sized {
    fn read_from<R: Read>(buffer: &mut R, order: ByteOrder) -> Result<Self>;
}

The StreamReader trait allows for reading and writing bytes to and from a buffer.

Example

use std::io::{Read, Result, Write};
use bytestream::*;

pub struct Foo {
    bar: bool,
    baz: u32,
}

impl StreamReader for Foo {
    fn read_from<R: Read>(buffer: &mut R, order: ByteOrder) -> Result<Self> {
        Ok(Self {
            bar: bool::read_from(buffer, order)?,
            baz: u32::read_from(buffer, order)?,
        })
    }
}

Required methods

fn read_from<R: Read>(buffer: &mut R, order: ByteOrder) -> Result<Self>[src]

Reads something from the specified buffer using the specified byte order.

Loading content...

Implementations on Foreign Types

impl StreamReader for bool[src]

impl StreamReader for u64[src]

impl StreamReader for u32[src]

impl StreamReader for u16[src]

impl StreamReader for u8[src]

impl StreamReader for i64[src]

impl StreamReader for i32[src]

impl StreamReader for i16[src]

impl StreamReader for i8[src]

Loading content...

Implementors

Loading content...