Ident and type for macro parameter

Hi,

I wonder if it's possible given a macro like this

macro_rules! test {
    ($test:ident) => {
        println!("{}", $value);
    }
}

To get both the value and type for $test or do I always have to send in the type of test as a separate input to the macro?

Cheers!

Macros have no abilities beyond normal code for working out the type of something. If you can't write it without macros, you can't write it with macros.

1 Like

Yeah that is a good point. Thanks!