pub struct MessageDescriptor { /* private fields */ }
Expand description

A protobuf message definition.

Implementations

Gets a reference to the DescriptorPool this message is defined in.

Gets the parent message type if this message type is nested inside a another message, or None otherwise

Gets the short name of the message type, e.g. MyMessage.

Gets the full name of the message type, e.g. my.package.MyMessage.

Gets the name of the package this message type is defined in, e.g. my.package.

If no package name is set, an empty string is returned.

Gets a reference to the FileDescriptorProto in which this message is defined.

Gets a reference to the raw DescriptorProto wrapped by this MessageDescriptor.

Gets an iterator yielding a FieldDescriptor for each field defined in this message.

Gets an iterator yielding a OneofDescriptor for each oneof field defined in this message.

Gets a FieldDescriptor with the given number, or None if no such field exists.

Gets a FieldDescriptor with the given name, or None if no such field exists.

Gets a FieldDescriptor with the given JSON name, or None if no such field exists.

source

pub fn is_map_entry(&self) -> bool

Returns true if this is an auto-generated message type to represent the entry type for a map field. If this method returns true, fields is guaranteed to yield the following two fields:

  • A “key” field with a field number of 1
  • A “value” field with a field number of 2

See map_entry_key_field and map_entry_value_field for more a convenient way to get these fields.

source

pub fn map_entry_key_field(&self) -> FieldDescriptor

If this is a map entry, returns a FieldDescriptor for the key.

Panics

This method may panic if is_map_entry returns false.

source

pub fn map_entry_value_field(&self) -> FieldDescriptor

If this is a map entry, returns a FieldDescriptor for the value.

Panics

This method may panic if is_map_entry returns false.

Gets an iterator over reserved field number ranges in this message.

Gets an iterator over reserved field names in this message.

Gets an iterator over extension field number ranges in this message.

Gets an iterator over extensions to this message.

Note this iterates over extension fields defined in any file which extend this message, rather than extensions defined nested within this message.

Gets an extension to this message by its number, or None if no such extension exists.

Gets an extension to this message by its JSON name (e.g. [my.package.my_extension]), or None if no such extension exists.

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

Deserialize a DynamicMessage from deserializer using the canonical JSON encoding.

The type produced by using this seed.

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

This method tests for !=.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. 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.