Skip to main content

Write

Trait Write 

Source
pub trait Write {
    type Error: Error;

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

    // Provided method
    fn write_all(&mut self, buf: &[u8]) -> Result<()> { ... }
}
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, Self::Error>

Write some bytes.

Source

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

Flush buffered output.

Provided Methods§

Source

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

Write all bytes, retrying interrupted operations.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

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

Source§

type Error = <T as Write>::Error

Source§

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

Available on crate feature std only.
Source§

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