Is it possible to create a derive procedural macro that has visibility into the target struct fields generics?
E.g. given this struct:
#[derive(MySpecialDerive)
struct SomeStruct
{
inner: SomeOtherStruct<usize, String>,
}
How can the code in MySpecialDerive (using ast stuff) get to the "usize" and "String" ?
There does not seem to be a way to get to generics of a field.
If I do
let Struct(outer_struct) = parsed.Data {
outer_struct.fields.first() // now I have a Field, I can get it's Type but how do I get it's generics??
}
I end up with syn::Field - Rust
How does that help me get the generic type of that inner struct??
Uff that's a deep dive Yeah at least this way I don't have to flail about hoping I'm on the right path.
Thanks