Struct prost_reflect::EnumDescriptor
source · 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 moresource§impl Debug for EnumDescriptor
impl Debug for EnumDescriptor
source§impl PartialEq for EnumDescriptor
impl PartialEq for EnumDescriptor
impl Eq for EnumDescriptor
impl StructuralPartialEq for EnumDescriptor
Auto Trait Implementations§
impl Freeze for EnumDescriptor
impl RefUnwindSafe for EnumDescriptor
impl Send for EnumDescriptor
impl Sync for EnumDescriptor
impl Unpin for EnumDescriptor
impl UnwindSafe for EnumDescriptor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)