Trait layered_io::WriteLayered[][src]

pub trait WriteLayered: Write + Bufferable {
    fn close(&mut self) -> Result<()>;

    fn flush_with_status(&mut self, status: Status) -> Result<()> { ... }
}
Expand description

An extension of std::io::Write, but adds a close function to allow the stream to be closed and any outstanding errors to be reported, without requiring a sync_all.

Required methods

fn close(&mut self) -> Result<()>[src]

Flush any buffers and declare the end of the stream. Subsequent writes will fail.

Provided methods

fn flush_with_status(&mut self, status: Status) -> Result<()>[src]

Like Write::flush, but has a status parameter describing the future of the stream:

  • Status::Ok(Activity::Active): do nothing
  • Status::Ok(Activity::Push): flush any buffers and transmit all data
  • Status::End: flush any buffers and declare the end of the stream

Passing Status::Ok(Activity::Push) makes this behave the same as flush().

Implementations on Foreign Types

impl WriteLayered for Cursor<Vec<u8>>[src]

fn close(&mut self) -> Result<()>[src]

impl WriteLayered for Cursor<Box<[u8]>>[src]

fn close(&mut self) -> Result<()>[src]

impl WriteLayered for Cursor<&mut Vec<u8>>[src]

fn close(&mut self) -> Result<()>[src]

impl WriteLayered for Cursor<&mut [u8]>[src]

fn close(&mut self) -> Result<()>[src]

impl<W: WriteLayered> WriteLayered for Box<W>[src]

fn close(&mut self) -> Result<()>[src]

impl<W: WriteLayered> WriteLayered for &mut W[src]

fn close(&mut self) -> Result<()>[src]

Implementors

impl<Inner: Read + Write> WriteLayered for LayeredDuplexer<Inner>[src]

fn close(&mut self) -> Result<()>[src]

impl<Inner: Write> WriteLayered for LayeredWriter<Inner>[src]

fn close(&mut self) -> Result<()>[src]