pub trait PbBufferWriter: Write {
    // Required method
    fn write_buffer<B: PbBuffer>(&mut self, buf: &B) -> Result<()>;
}
Expand description

All concrete types used for serialization should implement PbBufferWriter in order to support serializing Lazy fields without copies.

Required Methods§

source

fn write_buffer<B: PbBuffer>(&mut self, buf: &B) -> Result<()>

Attempt to write a zerocopy buffer into self. If B is not zero-copy-supported by the PbBufferWriter, this may read/copy the bytes out from buf.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> PbBufferWriter for Cursor<&'a mut Vec<u8>>

source§

fn write_buffer<B: PbBuffer>(&mut self, buf: &B) -> Result<()>

Note: this implementation freely copies the data out of buf.

source§

impl<'a> PbBufferWriter for Cursor<&'a mut [u8]>

source§

fn write_buffer<B: PbBuffer>(&mut self, buf: &B) -> Result<()>

Note: this implementation freely copies the data out of buf.

Implementors§

source§

impl<'a, W: Write + 'a> PbBufferWriter for CopyWriter<'a, W>