Struct protobuf::EnumOrUnknown
source · [−]#[repr(transparent)]pub struct EnumOrUnknown<E> { /* private fields */ }
Expand description
Protobuf enums with possibly unknown values are preserved in this struct.
Implementations
sourceimpl<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.
sourceimpl<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.
sourceimpl<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
sourceimpl<E: Clone> Clone for EnumOrUnknown<E>
impl<E: Clone> Clone for EnumOrUnknown<E>
sourcefn clone(&self) -> EnumOrUnknown<E>
fn clone(&self) -> EnumOrUnknown<E>
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<E: Enum + Debug> Debug for EnumOrUnknown<E>
impl<E: Enum + Debug> Debug for EnumOrUnknown<E>
sourceimpl<E: Enum> Default for EnumOrUnknown<E>
impl<E: Enum> Default for EnumOrUnknown<E>
sourcefn default() -> EnumOrUnknown<E>
fn default() -> EnumOrUnknown<E>
Returns the “default value” for a type. Read more
sourceimpl<E: Enum> From<E> for EnumOrUnknown<E>
impl<E: Enum> From<E> for EnumOrUnknown<E>
sourceimpl<E: Ord> Ord for EnumOrUnknown<E>
impl<E: Ord> Ord for EnumOrUnknown<E>
sourceimpl<E: PartialEq> PartialEq<EnumOrUnknown<E>> for EnumOrUnknown<E>
impl<E: PartialEq> PartialEq<EnumOrUnknown<E>> for EnumOrUnknown<E>
sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &EnumOrUnknown<E>) -> bool
fn ne(&self, other: &EnumOrUnknown<E>) -> bool
This method tests for !=
.
sourceimpl<E: PartialOrd> PartialOrd<EnumOrUnknown<E>> for EnumOrUnknown<E>
impl<E: PartialOrd> PartialOrd<EnumOrUnknown<E>> for EnumOrUnknown<E>
sourcefn partial_cmp(&self, other: &EnumOrUnknown<E>) -> Option<Ordering>
fn partial_cmp(&self, other: &EnumOrUnknown<E>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl<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> StructuralEq 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
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