I am trying to create a macro or syntax extension that will allow me to write something like that:
fn somefunc() {
let a = 0u64;
let b = 4i32;
probe!(a, b);
}
where a, b refers to existing variable names, and in this macro I want to be able to retrieve a and b types.
Here is what I’ve found:
syntax::ext::base provide following options:
a) syntax extension using MultiModifier (or AttrProcMacro?)
This work on ast and gives me access to type parameters, but only as a function decorator. I do not have a function here, so it doesn’t work for me.
b) ProcMacro. Operates on TokenStream, so no access to types yet, right? Doesnt work for me either.
Am I missing something, or is there any other way to do it?