Trait pb_jelly::PbBuffer [−][src]
pub trait PbBuffer: Any + Sized {
fn len(&self) -> usize;
fn copy_to_writer<W: Write + ?Sized>(&self, writer: &mut W) -> Result<()>;
fn copy_from_reader<B: Buf + ?Sized>(reader: &mut B) -> Result<Self>;
}
Expand description
A stand-in trait for any backing buffer store.
PbBuffer
s are expected to own references to the data they reference, and should be cheap
(constant-time) to clone.
Required methods
Fallback method to read the contents of self
. This method is expected to write exactly
self.len()
bytes into writer
, or fail with an error.
This method is used to write Lazy
fields to incompatible PbBufferWriter
s.
Fallback method to create an instance of this PbBuffer
.
This method is used to read Lazy
fields from incompatible PbBufferReader
s.