How could one implement a macro (called symbols!
in the following example) that stringifies the identifiers it receives separately, like this:
symbols![a b c de fgh]
=> vec!["a", "b", "c", "de", "fgh"]
?
How could one implement a macro (called symbols!
in the following example) that stringifies the identifiers it receives separately, like this:
symbols![a b c de fgh]
=> vec!["a", "b", "c", "de", "fgh"]
?
Hmm, not sure what I was doing wrong before, this seems to work:
macro_rules! symbols {
($($s:ident)*) => {
vec![$(stringify!($s)),*]
};
}