pub struct EnumDescriptor { /* private fields */ }
Expand description
A protobuf enum type.
Implementations§
Source§impl EnumDescriptor
impl EnumDescriptor
Sourcepub fn parent_pool(&self) -> &DescriptorPool
pub fn parent_pool(&self) -> &DescriptorPool
Gets a reference to the DescriptorPool
this enum type is defined in.
Sourcepub fn parent_file(&self) -> FileDescriptor
pub fn parent_file(&self) -> FileDescriptor
Gets the FileDescriptor
this enum type is defined in.
Sourcepub fn parent_message(&self) -> Option<MessageDescriptor>
pub fn parent_message(&self) -> Option<MessageDescriptor>
Gets the parent message type if this enum type is nested inside a another message, or None
otherwise
Sourcepub fn package_name(&self) -> &str
pub fn package_name(&self) -> &str
Gets the name of the package this enum type 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 enum type is defined within the FileDescriptorProto
, e.g. [5, 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 enum is defined.
Sourcepub fn enum_descriptor_proto(&self) -> &EnumDescriptorProto
pub fn enum_descriptor_proto(&self) -> &EnumDescriptorProto
Gets a reference to the raw EnumDescriptorProto
wrapped by this EnumDescriptor
.
Sourcepub fn options(&self) -> DynamicMessage
pub fn options(&self) -> DynamicMessage
Decodes the options defined for this EnumDescriptor
, including any extension options.
Sourcepub fn default_value(&self) -> EnumValueDescriptor
pub fn default_value(&self) -> EnumValueDescriptor
Gets the default value for the enum type.
Sourcepub fn get_value_by_name(&self, name: &str) -> Option<EnumValueDescriptor>
pub fn get_value_by_name(&self, name: &str) -> Option<EnumValueDescriptor>
Gets a EnumValueDescriptor
for the enum value with the given name, or None
if no such value exists.
Sourcepub fn get_value(&self, number: i32) -> Option<EnumValueDescriptor>
pub fn get_value(&self, number: i32) -> Option<EnumValueDescriptor>
Gets a EnumValueDescriptor
for the enum value with the given number, or None
if no such value exists.
If the enum is defined with the allow_alias
option and has multiple values with the given number, it is
unspecified which one will be returned.
Sourcepub fn values(&self) -> impl ExactSizeIterator<Item = EnumValueDescriptor> + '_
pub fn values(&self) -> impl ExactSizeIterator<Item = EnumValueDescriptor> + '_
Gets an iterator yielding a EnumValueDescriptor
for each value in this enum.
Sourcepub fn reserved_ranges(
&self,
) -> impl ExactSizeIterator<Item = RangeInclusive<i32>> + '_
pub fn reserved_ranges( &self, ) -> impl ExactSizeIterator<Item = RangeInclusive<i32>> + '_
Gets an iterator over reserved value number ranges in this enum.
Sourcepub fn reserved_names(&self) -> impl ExactSizeIterator<Item = &str> + '_
pub fn reserved_names(&self) -> impl ExactSizeIterator<Item = &str> + '_
Gets an iterator over reserved value names in this enum.
Trait Implementations§
Source§impl Clone for EnumDescriptor
impl Clone for EnumDescriptor
Source§fn clone(&self) -> EnumDescriptor
fn clone(&self) -> EnumDescriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more