Hi there,
I'm quite new to procedural macros and trying to use the return type of a function decorated with my custom attribute. I got so far retrieving the output like so:
let func = parse_macro_input!(item as ItemFn);
let output = func.decl.output;
However, the output gives ReturnType
enum that is either Default
or Type(_, _)
.
So the output looks like:
Output: Type(
RArrow,
Path(
TypePath {
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "u32",
span: #0 bytes(184..187),
},
arguments: None,
},
],
},
},
),
)
Is there an easy way to extract the u32
type info to be used in subsequent calls to quote!( )
?
Currently all my attempts failed so far... so any hint would be much appreciated.