Struct protobuf::reflect::MessageRef [−][src]
pub struct MessageRef<'a> { /* fields omitted */ }
Expand description
Wrapper around either Message
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.
pub fn write_length_delimited_to_dyn(
&self,
os: &mut CodedOutputStream<'_>
) -> ProtobufResult<()>
pub fn write_length_delimited_to_dyn(
&self,
os: &mut CodedOutputStream<'_>
) -> ProtobufResult<()>
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.
Downcast &dyn Message
to specific message type.
let m: &dyn MessageDyn = message;
let m: &MyMessage = MessageDyn::downcast_ref(m).unwrap();
Clone from a dyn Message
reference.
Reflectively compare the messages.
Trait Implementations
type Target = dyn MessageDyn
type Target = dyn MessageDyn
The resulting type after dereferencing.
Dereferences the value.
Performs the conversion.
Perform the equality comparison.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for MessageRef<'a>
impl<'a> Send for MessageRef<'a>
impl<'a> Sync for MessageRef<'a>
impl<'a> Unpin for MessageRef<'a>
impl<'a> !UnwindSafe for MessageRef<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more