How to retrieve an EnumDiscriminant variant from a MyEnum variant? #286
Unanswered
seanpianka
asked this question in
Q&A
Replies: 1 comment
-
There is a trait Note that the latest version on crates.io does not yet support that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The typenames I'm referencing are from the docs' examples for the trait. I have a
MyEnum
that derives the discriminant traits, and I would like to convert an instance of aMyEnum
variant into the corresponding variant ofEnumDiscriminants
enum.Once I achieve that, I'd like to then convert that into a
&str
. My plan is to convert a givenMyEnum
into its discriminant name as a string, and include that as a field in a tracing span field:where
command
is an instance ofMyEnum
.Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions