Trait pb_jelly::Message [−][src]
pub trait Message: PartialEq + Default + Debug + Any {
fn compute_size(&self) -> usize;
fn serialize<W: PbBufferWriter>(&self, w: &mut W) -> Result<()>;
fn deserialize<B: PbBufferReader>(&mut self, r: &mut B) -> Result<()>;
fn compute_grpc_slices_size(&self) -> usize { ... }
fn serialize_to_vec(&self) -> Vec<u8> { ... }
fn serialize_to_writer<W: Write>(&self, writer: &mut W) -> Result<()> { ... }
fn deserialize_from_slice(slice: &[u8]) -> Result<Self> { ... }
}
Expand description
Trait implemented by all the messages defined in proto files and base datatypes like string, bytes, etc. The exact details of this trait is implemented for messages and base types can be found at - https://developers.google.com/protocol-buffers/docs/encoding
Required methods
fn compute_size(&self) -> usize
fn compute_size(&self) -> usize
Computes the number of bytes a message will take when serialized. This does not include number of bytes required for tag+wire_format or the bytes used to represent length of the message in case of LengthDelimited messages/types.
Serializes the message to the writer.
fn deserialize<B: PbBufferReader>(&mut self, r: &mut B) -> Result<()>
fn deserialize<B: PbBufferReader>(&mut self, r: &mut B) -> Result<()>
Reads the message from the blob reader, copying as necessary.
Provided methods
fn compute_grpc_slices_size(&self) -> usize
fn compute_grpc_slices_size(&self) -> usize
Computes the number of bytes in all grpc slices. This information is used to optimize memory allocations in zero-copy encoding.
fn serialize_to_vec(&self) -> Vec<u8>
fn serialize_to_vec(&self) -> Vec<u8>
Helper method for serializing a message to a Vec