pub struct MessageRef<'a> { /* private fields */ }
Expand description

Wrapper around either MessageFull reference or a container for an empty dynamic message.

Implementations

Wrap a message.

Default (empty) instance of given message type.

Methods from Deref<Target = dyn MessageDyn>

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.

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.

Downcast &dyn Message to specific message type.

let m: &dyn MessageDyn = message;
let m: &MyMessage = <dyn MessageDyn>::downcast_ref(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
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Perform the equality comparison.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.