[][src]Trait linux::util::io::Write

pub trait Write {
    fn gather_write(&mut self, buf: &[&[u8]]) -> Result<usize>;
fn flush(&mut self) -> Result<()>; fn write(&mut self, buf: &[u8]) -> Result<usize> { ... }
fn write_all(&mut self, buf: &[u8]) -> Result<usize> { ... }
fn write_str(&mut self, buf: &str) -> Result<usize> { ... }
fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()> { ... } }

Objects that wrap a byte-stream for writing.

Required methods

fn gather_write(&mut self, buf: &[&[u8]]) -> Result<usize>

Writes multiple buffers to the byte-stream.

[argument, buf] The buffers to be written.

[return_value] Returns the total number of bytes written.

= Remarks

The method starts at the first buffer and writes each buffer completely before moving to the next one.

fn flush(&mut self) -> Result<()>

Loading content...

Provided methods

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

Write a buffer to the byte stream.

[argument, buf] The buffer to be written.

[return_value] Returns the total number of bytes written.

= Remarks

:gather: link:lrs::io::Write::gather_write[gather_write]

The default implementation calls {gather} with a single buffer.

= See also

  • {gather}

fn write_all(&mut self, buf: &[u8]) -> Result<usize>

Tries to write the complete buffer to the byte-stream.

[argument, buf] The buffer to be written.

[return_value] Returns the total number of bytes written.

= Remarks

:write: link:lrs::io::Write::writewrite

The default implementation calls write multiple times until the whole buffer has been written. If an error occurs, the error is returned immediately and the number of bytes written is lost. This method should thus not be used in reliable applications.

fn write_str(&mut self, buf: &str) -> Result<usize>

Writes a string to the byte-stream.

[argument, buf] The string to be written.

[return_value] Returns the total number of bytes written.

= Remarks

This is a convenience method that simply calls write.

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>

Loading content...

Implementations on Foreign Types

impl<'a> Write for &'a mut [u8][src]

fn write_all(&mut self, buf: &[u8]) -> Result<usize>[src]

fn write_str(&mut self, buf: &str) -> Result<usize>[src]

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>[src]

impl<'a> Write for &'a mut [d8][src]

fn write_all(&mut self, buf: &[u8]) -> Result<usize>[src]

fn write_str(&mut self, buf: &str) -> Result<usize>[src]

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>[src]

impl<'a, T: Write + ?Sized> Write for &'a mut T[src]

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>[src]

Loading content...

Implementors

impl Write for FdIo[src]

fn write_all(&mut self, buf: &[u8]) -> Result<usize>[src]

fn write_str(&mut self, buf: &str) -> Result<usize>[src]

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>[src]

impl Write for c_int[src]

fn write_all(&mut self, buf: &[u8]) -> Result<usize>[src]

fn write_str(&mut self, buf: &str) -> Result<usize>[src]

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>[src]

impl<'_> Write for &'_ FdIo[src]

fn write_all(&mut self, buf: &[u8]) -> Result<usize>[src]

fn write_str(&mut self, buf: &str) -> Result<usize>[src]

fn write_fmt_linux(&mut self, fmt: Arguments) -> Result<()>[src]

Loading content...