Struct prost_reflect::ExtensionDescriptor
source · pub struct ExtensionDescriptor { /* private fields */ }
Expand description
A protobuf extension field definition.
Implementations§
source§impl ExtensionDescriptor
impl ExtensionDescriptor
sourcepub fn parent_pool(&self) -> &DescriptorPool
pub fn parent_pool(&self) -> &DescriptorPool
Gets a reference to the DescriptorPool
this extension field is defined in.
sourcepub fn parent_file(&self) -> FileDescriptor
pub fn parent_file(&self) -> FileDescriptor
Gets the FileDescriptor
this extension field is defined in.
sourcepub fn parent_message(&self) -> Option<MessageDescriptor>
pub fn parent_message(&self) -> Option<MessageDescriptor>
Gets the parent message type if this extension is defined within another message, or None
otherwise.
Note this just corresponds to where the extension is defined in the proto file. See containing_message
for the message this field extends.
sourcepub fn full_name(&self) -> &str
pub fn full_name(&self) -> &str
Gets the full name of the extension field, e.g. my.package.ParentMessage.my_extension
.
Note this includes the name of the parent message if any, not the message this field extends.
sourcepub fn package_name(&self) -> &str
pub fn package_name(&self) -> &str
Gets the name of the package this extension field is defined in, e.g. my.package
.
If no package name is set, an empty string is returned.
sourcepub fn path(&self) -> &[i32]
pub fn path(&self) -> &[i32]
Gets the path where this extension field is defined within the FileDescriptorProto
, e.g. [7, 0]
.
See path
for more details on the structure of the path.
sourcepub fn parent_file_descriptor_proto(&self) -> &FileDescriptorProto
pub fn parent_file_descriptor_proto(&self) -> &FileDescriptorProto
Gets a reference to the FileDescriptorProto
in which this extension is defined.
sourcepub fn field_descriptor_proto(&self) -> &FieldDescriptorProto
pub fn field_descriptor_proto(&self) -> &FieldDescriptorProto
Gets a reference to the raw FieldDescriptorProto
wrapped by this ExtensionDescriptor
.
sourcepub fn options(&self) -> DynamicMessage
pub fn options(&self) -> DynamicMessage
Decodes the options defined for this ExtensionDescriptor
, including any extension options.
sourcepub fn json_name(&self) -> &str
pub fn json_name(&self) -> &str
Gets the name used for JSON serialization of this extension field, e.g. [my.package.ParentMessage.my_field]
.
sourcepub fn is_list(&self) -> bool
pub fn is_list(&self) -> bool
Whether this field is a list type.
Equivalent to checking that the cardinality is Repeated
and that
is_map
returns false
.
sourcepub fn is_map(&self) -> bool
pub fn is_map(&self) -> bool
Whether this field is a map type.
Equivalent to checking that the cardinality is Repeated
and that
the field type is a message where is_map_entry
returns true
.
sourcepub fn is_packed(&self) -> bool
pub fn is_packed(&self) -> bool
Whether this field is a list encoded using packed encoding.
sourcepub fn cardinality(&self) -> Cardinality
pub fn cardinality(&self) -> Cardinality
The cardinality of this field.
sourcepub fn supports_presence(&self) -> bool
pub fn supports_presence(&self) -> bool
Whether this extension supports distinguishing between an unpopulated field and the default value.
This is equivalent to cardinality() != Cardinality::Repeated
sourcepub fn containing_message(&self) -> MessageDescriptor
pub fn containing_message(&self) -> MessageDescriptor
Gets the containing message that this field extends.
Trait Implementations§
source§impl Clone for ExtensionDescriptor
impl Clone for ExtensionDescriptor
source§fn clone(&self) -> ExtensionDescriptor
fn clone(&self) -> ExtensionDescriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExtensionDescriptor
impl Debug for ExtensionDescriptor
source§impl PartialEq for ExtensionDescriptor
impl PartialEq for ExtensionDescriptor
source§fn eq(&self, other: &ExtensionDescriptor) -> bool
fn eq(&self, other: &ExtensionDescriptor) -> bool
self
and other
values to be equal, and is used
by ==
.