Struct protobuf::EnumOrUnknown
source · pub struct EnumOrUnknown<E> { /* private fields */ }
Expand description
Protobuf enums with possibly unknown values are preserved in this struct.
Implementations§
source§impl<E> EnumOrUnknown<E>
impl<E> EnumOrUnknown<E>
sourcepub const fn from_i32(value: i32) -> EnumOrUnknown<E>
pub const fn from_i32(value: i32) -> EnumOrUnknown<E>
Construct from any i32
value.
Note passed value is not required to be a valid enum value.
source§impl<E: Enum> EnumOrUnknown<E>
impl<E: Enum> EnumOrUnknown<E>
sourcepub fn new(e: E) -> EnumOrUnknown<E>
pub fn new(e: E) -> EnumOrUnknown<E>
Construct from typed enum
sourcepub fn enum_value(&self) -> Result<E, i32>
pub fn enum_value(&self) -> Result<E, i32>
Get i32
value as typed enum. Return None
is value is unknown.
sourcepub fn enum_value_or_default(&self) -> E
pub fn enum_value_or_default(&self) -> E
Get i32
value as typed enum.
Return default enum value (first value) if value is unknown.
sourcepub fn enum_value_or(&self, map_unknown: E) -> E
pub fn enum_value_or(&self, map_unknown: E) -> E
Get i32
value as typed enum.
Return given enum value if value is unknown.
source§impl<E: EnumFull> EnumOrUnknown<E>
impl<E: EnumFull> EnumOrUnknown<E>
sourcepub fn enum_descriptor() -> EnumDescriptor
pub fn enum_descriptor() -> EnumDescriptor
Get enum descriptor by type.
Trait Implementations§
source§impl<E: Clone> Clone for EnumOrUnknown<E>
impl<E: Clone> Clone for EnumOrUnknown<E>
source§fn clone(&self) -> EnumOrUnknown<E>
fn clone(&self) -> EnumOrUnknown<E>
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<E: Enum> Default for EnumOrUnknown<E>
impl<E: Enum> Default for EnumOrUnknown<E>
source§fn default() -> EnumOrUnknown<E>
fn default() -> EnumOrUnknown<E>
Returns the “default value” for a type. Read more
source§impl<E: Enum> From<E> for EnumOrUnknown<E>
impl<E: Enum> From<E> for EnumOrUnknown<E>
source§impl<E: Ord> Ord for EnumOrUnknown<E>
impl<E: Ord> Ord for EnumOrUnknown<E>
source§fn cmp(&self, other: &EnumOrUnknown<E>) -> Ordering
fn cmp(&self, other: &EnumOrUnknown<E>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<E: PartialEq> PartialEq for EnumOrUnknown<E>
impl<E: PartialEq> PartialEq for EnumOrUnknown<E>
source§fn eq(&self, other: &EnumOrUnknown<E>) -> bool
fn eq(&self, other: &EnumOrUnknown<E>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<E: PartialOrd> PartialOrd for EnumOrUnknown<E>
impl<E: PartialOrd> PartialOrd for EnumOrUnknown<E>
source§fn partial_cmp(&self, other: &EnumOrUnknown<E>) -> Option<Ordering>
fn partial_cmp(&self, other: &EnumOrUnknown<E>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<E: EnumFull> ProtobufValue for EnumOrUnknown<E>
impl<E: EnumFull> ProtobufValue for EnumOrUnknown<E>
§type RuntimeType = RuntimeTypeEnumOrUnknown<E>
type RuntimeType = RuntimeTypeEnumOrUnknown<E>
Actual implementation of type properties.
impl<E: Copy> Copy for EnumOrUnknown<E>
impl<E: Eq> Eq for EnumOrUnknown<E>
impl<E> StructuralPartialEq for EnumOrUnknown<E>
Auto Trait Implementations§
impl<E> RefUnwindSafe for EnumOrUnknown<E>where
E: RefUnwindSafe,
impl<E> Send for EnumOrUnknown<E>where
E: Send,
impl<E> Sync for EnumOrUnknown<E>where
E: Sync,
impl<E> Unpin for EnumOrUnknown<E>where
E: Unpin,
impl<E> UnwindSafe for EnumOrUnknown<E>where
E: UnwindSafe,
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