Macro: capture ident -> &'static str?

macro_rules! foo!($x: ident) {}

foo!(hello) -> "hello"
foo!(world) -> "world"

Is the above possible? Context; doing some macro that generates a struct with fields, but with certain errors happens with fields, I want to print out the field name.



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.