Trait Describe

Source
pub trait Describe: Sized + 'static {
    // Required methods
    fn caption() -> &'static str;
    fn iter() -> impl Iterator<Item = &'static Self>;
    fn into_iter() -> impl Iterator<Item = Self>;
    fn rustdoc(&self) -> &'static str;
    fn describe(&self) -> &'static str;
    fn as_str(&self) -> &'static str;
    fn as_str_ns(&self) -> &'static str;
    fn from_str(str: &str) -> Option<Self>;
    fn from_str_ns(str: &str) -> Option<Self>;
}
Expand description

Enum trait used by the Describe derive macro

Required Methods§

Source

fn caption() -> &'static str

return a caption for the enum declared by the #[caption=""] attribute

Source

fn iter() -> impl Iterator<Item = &'static Self>

return all permutations of the enum as an iterator

Source

fn into_iter() -> impl Iterator<Item = Self>

converts enum into an iterator

Source

fn rustdoc(&self) -> &'static str

return rust doc text describing the enum value

Source

fn describe(&self) -> &'static str

return #[describe=""] text describing the enum value

Source

fn as_str(&self) -> &'static str

return enum value as a string without namespace (i.e. Value)

Source

fn as_str_ns(&self) -> &'static str

return enum value as a string with namespace (i.e. Enum::Value)

Source

fn from_str(str: &str) -> Option<Self>

get enum value from the value string without namespace (i.e. Value)

Source

fn from_str_ns(str: &str) -> Option<Self>

get enum value from the value string with namespace (i.e. Enum::Value)

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§