As opposed to this question, I'd like to match on the syntactic level. E.g. I'd like to do something such as:
macro_rules! do_x {
($x:ident) => {
$x.do().some().things();
};
($x:ty) => {
<$x>::singleton().do().some().things();
};
}
Clearly Rust already knows if the token is a type or not, because it errors out when I try to pass a non-type into a macro that's expecting a type. Is there a way to leverage this in the macro matching rules, instead of defining another macro that does the same exact thing as the first one?