Trait pb_jelly::PbBufferReader
source · pub trait PbBufferReader: Buf {
// Required method
fn split(&mut self, at: usize) -> Self;
// Provided method
fn read_buffer<B: PbBuffer>(&mut self) -> Result<B> { ... }
}
Expand description
All concrete types which are used for deserialization should implement PbBufferReader, which includes functions to convert to and from PbBuffer.
Required Methods§
sourcefn split(&mut self, at: usize) -> Self
fn split(&mut self, at: usize) -> Self
Advance the interal cursor by at
, and return a PbBufferReader corresponding to the
traversed indices (i.e. self.position..self.position + at).
Provided Methods§
sourcefn read_buffer<B: PbBuffer>(&mut self) -> Result<B>
fn read_buffer<B: PbBuffer>(&mut self) -> Result<B>
Attempt to read into a compatible PbBuffer, avoiding a copy if possible.
The implementation should dispatch on the type B
. If unsupported,
the reader may fall back to PbBuffer::copy_from_reader.
Object Safety§
This trait is not object safe.