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

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.

Reads the message from the blob reader, copying as necessary.

Provided methods

Computes the number of bytes in all grpc slices. This information is used to optimize memory allocations in zero-copy encoding.

Helper method for serializing a message to a Vec.

Helper method for serializing a message to an arbitrary Write.

If there are Lazy fields in the message, their contents will be copied out.

Helper method for deserializing a message from a u8 slice.

This will error if there are any Lazy fields in the message.

Implementations on Foreign Types

Implementors