Trait bincode_core::CoreWrite[][src]

pub trait CoreWrite {
    type Error: Debug;
    fn write(&mut self, val: u8) -> Result<(), Self::Error>;

    fn flush(&mut self) -> Result<(), Self::Error> { ... }
fn write_all(&mut self, val: &[u8]) -> Result<(), Self::Error> { ... } }

A target that can be written to. This is similar to std::io::Write, but the std trait is not available in #![no_std] projects.

This trait is auto-implemented for [BufferWriter], but can also be implemented to write to an e.g. embedded_hal::serial::Write.

Associated Types

type Error: Debug[src]

The error that this writer can encounter

Loading content...

Required methods

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

Write a single byte to the writer. This is assumed to be blocking, if the underlying writer is non-blocking, the value should be written to a backing buffer instead.

Loading content...

Provided methods

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

Flush the writer. This should empty any backing buffer and ensure all data is transferred. This function should block until all data is flushed.

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

Helper function to write multiple bytes to a writer. The default implementation calls write with each byte in the slice.

Loading content...

Implementations on Foreign Types

impl CoreWrite for ()[src]

type Error = ()

Loading content...

Implementors

impl CoreWrite for &mut BufferWriter<'_>[src]

type Error = BufferWriterError

impl CoreWrite for BufferWriter<'_>[src]

type Error = BufferWriterError

Loading content...