[][src]Trait io::Write

pub trait Write<T: Copy> {
    type Err;
    fn flush(&mut self) -> Result<(), Self::Err>;

    fn write(&mut self, buf: &[T]) -> Result<usize, Self::Err> { ... }
fn writev(&mut self, bufs: &[&[T]]) -> Result<usize, Self::Err> { ... }
fn write_all(&mut self, buf: &[T]) -> Result<(), (Self::Err, usize)>
    where
        Self::Err: From<EndOfFile>
, { ... }
fn write_all_e(
        &mut self,
        buf: &[T]
    ) -> Result<(), (Either<EndOfFile, Self::Err>, usize)> { ... } }

Associated Types

type Err

Loading content...

Required methods

fn flush(&mut self) -> Result<(), Self::Err>

Loading content...

Provided methods

fn write(&mut self, buf: &[T]) -> Result<usize, Self::Err>

w.write(buf) = self.writev(&[buf])

fn writev(&mut self, bufs: &[&[T]]) -> Result<usize, Self::Err>

Push some data, at most bufs.fold(0, |n, buf| n+buf.len()), to this sink from given buffers; return how many data were actually written, or a failure. May block if no data can be written when called.

If this returns 0 data written, the possibilities are these:

  • bufs.all(|buf| buf.len() == 0)
  • The writer reached some end, and can unlikely consume further bytes, at least temporarily.

fn write_all(&mut self, buf: &[T]) -> Result<(), (Self::Err, usize)> where
    Self::Err: From<EndOfFile>, 

Push buf.len() data to this sink from given buffer; return () if so many data were actually written, or a failure and how many data were written before the failure.

fn write_all_e(
    &mut self,
    buf: &[T]
) -> Result<(), (Either<EndOfFile, Self::Err>, usize)>

Push buf.len() data to this sink from given buffer; return () if so many data were actually written, or a failure and how many data were written before the failure.

Loading content...

Implementors

impl<'a, T: Copy, W: ?Sized + DerefMut> Write<T> for W where
    W::Target: Write<T>, 
[src]

type Err = <W::Target as Write<T>>::Err

impl<S: Copy, T: DerefMut<Target = [S]>> Write<S> for Pos<T>[src]

type Err = Void

Loading content...