Struct protobuf::reflect::EnumDescriptor
source · [−]pub struct EnumDescriptor { /* private fields */ }
Expand description
Dynamic representation of enum type.
Can be used in reflective operations.
Implementations
sourceimpl 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 first_value(&self) -> EnumValueDescriptor
pub fn first_value(&self) -> EnumValueDescriptor
First variant (also default in proto3).
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
sourceimpl Clone for EnumDescriptor
impl Clone for EnumDescriptor
sourcefn clone(&self) -> EnumDescriptor
fn clone(&self) -> EnumDescriptor
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for EnumDescriptor
impl Debug for EnumDescriptor
sourceimpl Display for EnumDescriptor
impl Display for EnumDescriptor
sourceimpl Hash for EnumDescriptor
impl Hash for EnumDescriptor
sourceimpl PartialEq<EnumDescriptor> for EnumDescriptor
impl PartialEq<EnumDescriptor> for EnumDescriptor
sourcefn eq(&self, other: &EnumDescriptor) -> bool
fn eq(&self, other: &EnumDescriptor) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &EnumDescriptor) -> bool
fn ne(&self, other: &EnumDescriptor) -> bool
This method tests for !=
.
impl Eq for EnumDescriptor
impl StructuralEq for EnumDescriptor
impl StructuralPartialEq for EnumDescriptor
Auto Trait Implementations
impl !RefUnwindSafe for EnumDescriptor
impl Send for EnumDescriptor
impl Sync for EnumDescriptor
impl Unpin for EnumDescriptor
impl !UnwindSafe for EnumDescriptor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more