darling icon indicating copy to clipboard operation
darling copied to clipboard

WithOriginal and UsesTypeParams/UsesLifetimes

Open nkovacs opened this issue 2 years ago • 1 comments

I had a data that looked like this:

data: ast::Data<darling::util::Ignored, MyField>,

and I implemented UsesTypeParams and UsesLifetimes for MyField, so I could use data.uses_type_params_cloned and everything was great.

Then I needed access to the original syn::Field, so I found WithOriginal, and changed my data to this:

data: ast::Data<darling::util::Ignored, WithOriginal<MyField, syn::Field>>,

but this broke data.uses_type_params_cloned (and uses_lifetimes_cloned) because WithOriginal does not implement these two traits.

Wouldn't it make sense for WithOriginal to forward these traits to the parsed type?

nkovacs avatar Dec 12 '22 13:12 nkovacs

Yes, that sounds reasonable to me.

TedDriggs avatar Dec 12 '22 21:12 TedDriggs