Trait packed_struct::PrimitiveEnum
[−]
[src]
pub trait PrimitiveEnum<T> where
T: Sized + Copy + Debug,
Self: Sized + Copy, { fn from_primitive(val: T) -> Option<Self>; fn to_primitive(&self) -> T; fn to_display_str(&self) -> &'static str; fn from_str(s: &str) -> Option<Self>; fn all_variants() -> &'static [Self]; }
An enum type that can be packed or unpacked from a simple primitive integer.
Required Methods
fn from_primitive(val: T) -> Option<Self>
Convert from a primitive, might fail.
fn to_primitive(&self) -> T
Convert to a primitive value.
fn to_display_str(&self) -> &'static str
Display value, same as the name of a particular variant.
fn from_str(s: &str) -> Option<Self>
Convert from a string value representing the variant.
fn all_variants() -> &'static [Self]
A list all possible string variants.