i want to try to get a element of enum from a string that given by user (runtime),just like: if i have string "A", and a enum A { A, B, C},then a function get "A" and return A::A.
i have tried macro and proc_macro_derive but in vain, i think the best solution that i hope is just use #[derive(something)] and give a parse_elem function,but i don't know how to do this, is it possible?
You might be searching for https://lib.rs/crates/strum
9 Likes
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.