Writer

Trait Writer 

Source
pub trait Writer {
    // Required method
    fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError>;
}
Expand description

Trait that indicates that a struct can be used as a destination to encode data too. This is used by Encode

Required Methods§

Source

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

Write bytes to the underlying writer. Exactly bytes.len() bytes must be written, or else an error should be returned.

§Errors

Returns EncodeError::UnexpectedEnd if the writer does not have enough space.

Implementations on Foreign Types§

Source§

impl<T: Writer> Writer for &mut T

Source§

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

Implementors§

Source§

impl Writer for VecWriter

Available on crate feature alloc only.
Source§

impl Writer for SizeWriter

Source§

impl Writer for SliceWriter<'_>

Source§

impl<W: Write> Writer for IoWriter<'_, W>

Available on crate feature std only.