Trait ValuedEnum

Source
pub trait ValuedEnum<T>
where Self: Sized,
{ // Required methods fn equal(&self, other: &T) -> bool; fn key(&self) -> &str; fn value(self) -> T; fn ref_value(&self) -> &T; fn keys() -> Vec<&'static str>; fn values() -> Vec<T>; fn variants() -> Vec<Self>; fn from_key(key: &str) -> Option<Self>; fn from_value(value: &T) -> Option<Self>; }

Required Methods§

Source

fn equal(&self, other: &T) -> bool

Source

fn key(&self) -> &str

Source

fn value(self) -> T

Source

fn ref_value(&self) -> &T

Source

fn keys() -> Vec<&'static str>

Source

fn values() -> Vec<T>

Source

fn variants() -> Vec<Self>

Source

fn from_key(key: &str) -> Option<Self>

Source

fn from_value(value: &T) -> Option<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§