[][src]Trait bi::Bi

pub trait Bi {
    type Input;
    type Output;
    fn max_buf_size(&self) -> usize;
fn buf_size(&self) -> usize;
fn read(&self, res: Self::Input) -> Result<(usize, Vec<u8>)>;
fn read_to_string(&self, res: Self::Input) -> Result<(usize, String)>;
fn release_read(&self, read_id: usize) -> Result<()>;
fn write<B: AsRef<[u8]>>(
        &self,
        bytes: B,
        res: &mut Self::Output
    ) -> Result<()>; }

Bi

Simple trait for reading/writing resources


Implementations are not required to make read/write IDs unique. It's simply because usize has limit. However, for example, on 32-bit system, you still have billions of IDs to use.

Associated Types

Loading content...

Required methods

fn max_buf_size(&self) -> usize

fn buf_size(&self) -> usize

fn read(&self, res: Self::Input) -> Result<(usize, Vec<u8>)>

fn read_to_string(&self, res: Self::Input) -> Result<(usize, String)>

fn release_read(&self, read_id: usize) -> Result<()>

fn write<B: AsRef<[u8]>>(&self, bytes: B, res: &mut Self::Output) -> Result<()>

Loading content...

Implementors

impl<R, W> Bi for RwBi<R, W> where
    R: Read,
    W: Write
[src]

type Input = R

type Output = W

Loading content...