pub trait MessageDyn: Any + Debug + Display + Send + Sync + 'static {
    fn descriptor_dyn(&self) -> MessageDescriptor;
    fn merge_from_dyn(&mut self, is: &mut CodedInputStream<'_>) -> Result<()>;
    fn write_to_with_cached_sizes_dyn(
        &self,
        os: &mut CodedOutputStream<'_>
    ) -> Result<()>; fn compute_size_dyn(&self) -> u64; fn is_initialized_dyn(&self) -> bool; fn special_fields_dyn(&self) -> &SpecialFields; fn mut_special_fields_dyn(&mut self) -> &mut SpecialFields; }
Expand description

Dynamic-dispatch version of either generated message or dynamic message.

Generated messages implement MessageFull unless lite runtime requested. Dynamic messages can be created with FileDescriptor::new_dynamic.

Required Methods

Message descriptor for this message, used for reflection.

Update this message fields with contents of given stream.

Write the message.

Compute (and cache) the message size.

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

Get a reference to special fields.

Get a mutable reference to special fields.

Implementations

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 the stream.

Results in error if message is not fully initialized.

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.

Write the message to bytes vec.

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

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

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.

Downcast Box<dyn Message> to specific message type.

let m: Box<dyn MessageDyn> = message;
let m: Box<MyMessage> = <dyn MessageDyn>::downcast_box(m).unwrap();

Downcast &dyn Message to specific message type.

let m: &dyn MessageDyn = message;
let m: &MyMessage = <dyn MessageDyn>::downcast_ref(m).unwrap();

Downcast &mut dyn Message to specific message type.

let m: &mut dyn MessageDyn = message;
let m: &mut MyMessage = <dyn MessageDyn>::downcast_mut(m).unwrap();

Clone from a dyn Message reference.

Reflectively compare the messages.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Implementors