Skip to main content

Write

Trait Write 

Source
pub trait Write {
    type Error: Error;

    // Required methods
    fn write(&mut self, buf: &[u8]) -> Result<usize, Error<Self::Error>>;
    fn flush(&mut self) -> Result<(), Error<Self::Error>>;

    // Provided method
    fn write_all(&mut self, buf: &[u8]) -> Result<(), Error> { ... }
}
Expand description

Write bytes to a destination.

Required Associated Types§

Source

type Error: Error

Error returned by the underlying destination.

Required Methods§

Source

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

Write some bytes.

Source

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

Flush buffered output.

Provided Methods§

Source

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

Write all bytes, retrying interrupted operations.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<DATA> Write for IsoCursor<DATA>
where DATA: Write + Seek,

Source§

type Error = <DATA as Write>::Error

Source§

fn write( &mut self, buf: &[u8], ) -> Result<usize, Error<<IsoCursor<DATA> as Write>::Error>>

Source§

fn flush(&mut self) -> Result<(), Error<<IsoCursor<DATA> as Write>::Error>>

Source§

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

Implementors§

Source§

impl<T> Write for Borrowed<'_, T>
where T: Write + ?Sized,

Source§

type Error = <T as Write>::Error

Source§

impl<T> Write for FromEmbedded<T>
where T: Write,

Source§

impl<T> Write for T
where T: Write + ?Sized,

Available on crate feature std only.