#[derive(TryScribeStaticStr)]
{
// Attributes available to this derive:
#[enumscribe]
}
Expand description
Derives enumscribe::TryScribeStaticStr for an enum. This allows the enum to be converted to
a Option<&'static str> using the try_scribe() method.
You may annotate variants with #[enumscribe(str = "foo")] to specify what string the variant
should be converted to (replacing "foo" with a string of your choice). If this is omitted,
the name of the variant will be used instead. Using the same string for two variants of the
same enum will cause a compile-time error.
This is a version of ScribeStaticStr intended to be used if
you have one or more variants annotated with #[enumscribe(ignore)]. Calling try_scribe()
on an ignored variant will always return None.
Like ScribeStaticStr, you may not use #[enumscribe(other)]
when deriving this trait. If you want to use other, try deriving
TryScribeCowStr instead.