Derive Macro workflow_core::prelude::Describe

source ·
#[derive(Describe)]
{
    // Attributes available to this derive:
    #[descr]
    #[describe]
}
Expand description

Attribute macro for automatic conversion of enums to their string representation

This macro works only with pure enums (it does not support enums that have values represented as structs)

This macro implements the following methods:

// returns a Vec of all enum permutations
fn list() -> Vec<MyEnum>;
// returns the `rustdoc` description of the enum
fn descr(&self) -> &'static str;
// return the name of the value i.e. `Value`
fn as_str(&self) -> &'static str;
// return the the namespaced enum value i.e. `MyEnum::Value`
fn as_str_ns(&self)->&'static str;
// get enum value from the name i.e. `Value`
fn from_str(str:&str)->Option<MyEnum>;
// get enum value from the namespaced value name i.e. `MyEnum::Value`
fn from_str_ns(str:&str)->Option<#enum_name>;