pub trait Message: Default + Clone + Send + Sync + Sized + PartialEq + 'static {
    const NAME: &'static str;
Show 26 methods fn is_initialized(&self) -> bool; fn merge_from(&mut self, is: &mut CodedInputStream<'_>) -> Result<()>; fn write_to_with_cached_sizes(
        &self,
        os: &mut CodedOutputStream<'_>
    ) -> Result<()>; fn compute_size(&self) -> u64; fn special_fields(&self) -> &SpecialFields; fn mut_special_fields(&mut self) -> &mut SpecialFields; fn new() -> Self; fn default_instance() -> &'static Self; fn parse_from(is: &mut CodedInputStream<'_>) -> Result<Self> { ... } fn cached_size(&self) -> u32 { ... } fn write_to(&self, os: &mut CodedOutputStream<'_>) -> Result<()> { ... } fn write_length_delimited_to(
        &self,
        os: &mut CodedOutputStream<'_>
    ) -> Result<()> { ... } fn write_length_delimited_to_vec(&self, vec: &mut Vec<u8>) -> Result<()> { ... } fn merge_from_bytes(&mut self, bytes: &[u8]) -> Result<()> { ... } fn parse_from_reader(reader: &mut dyn Read) -> Result<Self> { ... } fn parse_from_bytes(bytes: &[u8]) -> Result<Self> { ... } fn parse_from_tokio_bytes(bytes: &Bytes) -> Result<Self> { ... } fn check_initialized(&self) -> Result<()> { ... } fn write_to_writer(&self, w: &mut dyn Write) -> Result<()> { ... } fn write_to_vec(&self, v: &mut Vec<u8>) -> Result<()> { ... } fn write_to_bytes(&self) -> Result<Vec<u8>> { ... } fn write_length_delimited_to_writer(&self, w: &mut dyn Write) -> Result<()> { ... } fn write_length_delimited_to_bytes(&self) -> Result<Vec<u8>> { ... } fn unknown_fields(&self) -> &UnknownFields { ... } fn mut_unknown_fields(&mut self) -> &mut UnknownFields { ... } fn clear(&mut self) { ... }
}
Expand description

Trait which is implemented by all generated message.

Note, by default all generated messages also implement MessageFull trait which provides access to reflection and features which depend on reflection (text format and JSON serialization).

Required Associated Constants

Message name as specified in .proto file.

Message name can be accessed using MessageFull::descriptor, but when lite runtime is requested, this field can be used.

Required Methods

True iff all required fields are initialized. Always returns true for protobuf 3.

Update this message object with fields read from given stream.

Write message to the stream.

Sizes of this messages and nested messages must be cached by calling compute_size prior to this call.

Compute and cache size of this message and all nested messages.

Note if the computation overflows u32, the cached size is stored truncated.

Special fields (unknown fields and cached size).

Special fields (unknown fields and cached size).

Create an empty message object.

let m = MyMessage::new();

Return a pointer to default immutable message with static lifetime.

let m: &MyMessage = MyMessage::default_instance();

Provided Methods

Parse message from stream.

Get size previously computed by compute_size.

Note if message size exceeds u32, the cached size is stored truncated.

Write the message to the stream.

Results in error if message is not fully initialized.

Write the message to the stream prepending the message with message length encoded as varint.

Write the message to the vec, prepend the message with message length encoded as varint.

Update this message object with fields read from given stream.

Parse message from reader. Parse stops on EOF or when error encountered.

Parse message from byte array.

Parse message from Bytes object. Resulting message may share references to the passed bytes object.

Check if all required fields of this object are initialized.

Write the message to the writer.

Write the message to bytes vec.

Write the message to bytes vec.

Note: You can use Message::parse_from_bytes to do the reverse.

Write the message to the writer, prepend the message with message length encoded as varint.

Write the message to the bytes vec, prepend the message with message length encoded as varint.

Get a reference to unknown fields.

Get a mutable reference to unknown fields.

Reset all fields.

Implementors