pub struct EnumDescriptor { /* private fields */ }
Expand description
Dynamic representation of enum type.
Can be used in reflective operations.
Implementations§
Source§impl EnumDescriptor
impl EnumDescriptor
Sourcepub fn proto(&self) -> &EnumDescriptorProto
pub fn proto(&self) -> &EnumDescriptorProto
Descriptor objects which defined this enum.
Sourcepub fn name_to_package(&self) -> &str
pub fn name_to_package(&self) -> &str
Name relative to the package where the message is declared.
Sourcepub fn for_type<E: EnumFull>() -> EnumDescriptor
pub fn for_type<E: EnumFull>() -> EnumDescriptor
Get EnumDescriptor
object for given enum type
Sourcepub fn enclosing_message(&self) -> Option<MessageDescriptor>
pub fn enclosing_message(&self) -> Option<MessageDescriptor>
Get a message containing this message, or None
if this message is declared at file level.
Sourcepub fn values<'a>(&'a self) -> impl Iterator<Item = EnumValueDescriptor> + 'a
pub fn values<'a>(&'a self) -> impl Iterator<Item = EnumValueDescriptor> + 'a
This enum values
Sourcepub fn value_by_name(&self, name: &str) -> Option<EnumValueDescriptor>
pub fn value_by_name(&self, name: &str) -> Option<EnumValueDescriptor>
Find enum variant by name
Sourcepub fn value_by_number(&self, number: i32) -> Option<EnumValueDescriptor>
pub fn value_by_number(&self, number: i32) -> Option<EnumValueDescriptor>
Find enum variant by number
Sourcepub fn value_by_index(&self, index: usize) -> EnumValueDescriptor
pub fn value_by_index(&self, index: usize) -> EnumValueDescriptor
Get enum variant by index (as declared in .proto
file).
Sourcepub fn default_value(&self) -> EnumValueDescriptor
pub fn default_value(&self) -> EnumValueDescriptor
Default enum value (first variant).
Sourcepub fn value_by_number_or_default(&self, number: i32) -> EnumValueDescriptor
pub fn value_by_number_or_default(&self, number: i32) -> EnumValueDescriptor
Find enum variant by number or return default (first) enum value
Trait Implementations§
Source§impl Clone for EnumDescriptor
impl Clone for EnumDescriptor
Source§fn clone(&self) -> EnumDescriptor
fn clone(&self) -> EnumDescriptor
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EnumDescriptor
impl Debug for EnumDescriptor
Source§impl Display for EnumDescriptor
impl Display for EnumDescriptor
Source§impl Hash for EnumDescriptor
impl Hash 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
Mutably borrows from an owned value. Read more