Trait packed_struct::PrimitiveEnum
source · pub trait PrimitiveEnumwhere
Self: Sized + Copy,{
type Primitive: PartialEq + Sized + Copy + Debug;
fn from_primitive(val: Self::Primitive) -> Option<Self>;
fn to_primitive(&self) -> Self::Primitive;
fn from_str(s: &str) -> Option<Self>;
fn from_str_lower(s: &str) -> Option<Self>;
}
Expand description
An enum type that can be packed or unpacked from a simple primitive integer.
Required Associated Types
Required Methods
sourcefn from_primitive(val: Self::Primitive) -> Option<Self>
fn from_primitive(val: Self::Primitive) -> Option<Self>
Convert from a primitive, might fail.
sourcefn to_primitive(&self) -> Self::Primitive
fn to_primitive(&self) -> Self::Primitive
Convert to a primitive value.
sourcefn from_str(s: &str) -> Option<Self>
fn from_str(s: &str) -> Option<Self>
Convert from a string value representing the variant. Case sensitive.
sourcefn from_str_lower(s: &str) -> Option<Self>
fn from_str_lower(s: &str) -> Option<Self>
Convert from a string value representing the variant. Lowercase.