Skip to main content

Write

Trait Write 

Source
pub trait Write {
    // Required methods
    fn write(&mut self, buf: &[u8]) -> Result<usize, AxError>;
    fn flush(&mut self) -> Result<(), AxError>;

    // Provided methods
    fn write_all(&mut self, buf: &[u8]) -> Result<(), AxError> { ... }
    fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), AxError> { ... }
    fn by_ref(&mut self) -> &mut Self
       where Self: Sized { ... }
}
Expand description

A trait for objects which are byte-oriented sinks.

See [std::io::Write] for more details.

Required Methods§

Source

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

Write a buffer into this writer, returning how many bytes were written.

Source

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

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.

Provided Methods§

Source

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

Attempts to write an entire buffer into this writer.

Source

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), AxError>

Writes a formatted string into this writer, returning any error encountered.

Source

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write.

The returned adapter also implements Write and will simply borrow this current writer.

Implementations on Foreign Types§

Source§

impl Write for &mut [u8]

Source§

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

Source§

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

Source§

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

Source§

impl Write for BorrowedCursor<'_>

Source§

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

Source§

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

Source§

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

Source§

impl<W> Write for &mut W
where W: Write + ?Sized,

Source§

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

Source§

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

Source§

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

Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), AxError>

Implementors§

Source§

impl Write for &Empty

Source§

impl Write for &Sink

Source§

impl Write for Cursor<&mut [u8]>

Source§

impl Write for Empty

Source§

impl Write for Sink

Source§

impl Write for Stdout

Source§

impl Write for StdoutLock<'_>

Source§

impl<W> Write for BufWriter<W>
where W: Write + ?Sized,

Source§

impl<W> Write for LineWriter<W>
where W: Write + ?Sized,

Source§

impl<W> Write for WriteFn<W>
where W: FnMut(&[u8]) -> Result<usize, AxError>,

Source§

impl<const N: usize> Write for Cursor<[u8; N]>