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§impl<E: PartialOrd> PartialOrd for EnumOrUnknown<E>
impl<E: PartialOrd> PartialOrd for EnumOrUnknown<E>
Source§impl<E: EnumFull> ProtobufValue for EnumOrUnknown<E>
impl<E: EnumFull> ProtobufValue for EnumOrUnknown<E>
Source§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> Freeze for EnumOrUnknown<E>
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