PbWrite

Trait PbWrite 

Source
pub trait PbWrite {
    type Error;

    // Required method
    fn pb_write(&mut self, data: &[u8]) -> Result<(), Self::Error>;
}
Expand description

A writer to which Protobuf data is written, similar to std::io::Write.

PbEncoder uses this trait as the interface for writing encoded Protobuf messages.

This trait is implemented for common byte vector types such as heapless::Vec and Vec. The implementations are feature-gated.

Required Associated Types§

Source

type Error

I/O error returned on write failure.

Required Methods§

Source

fn pb_write(&mut self, data: &[u8]) -> Result<(), Self::Error>

Writes all bytes in data.

This is analogous to std::io::Write::write_all.

Implementations on Foreign Types§

Source§

impl PbWrite for &mut [u8]

Source§

type Error = ()

Source§

fn pb_write(&mut self, data: &[u8]) -> Result<(), Self::Error>

Source§

impl PbWrite for Vec<u8>

Available on crate feature alloc only.
Source§

type Error = Infallible

Source§

fn pb_write(&mut self, data: &[u8]) -> Result<(), Self::Error>

Source§

impl<W: PbWrite> PbWrite for &mut W

Source§

type Error = <W as PbWrite>::Error

Source§

fn pb_write(&mut self, data: &[u8]) -> Result<(), Self::Error>

Implementors§

Source§

impl<W: Write> PbWrite for StdWriter<W>

Available on crate feature std only.