typeshare
typeshare copied to clipboard
Use `serde-derive-internals` to process related serde attributes
Right now we are using hacky workarounds to resolve serde attributes on typeshared types - ideally, we should be utilizing serde's internal attribute parser instead.
@InquisitivePenguin I had a first look at this and it would probably also require #120 to be done either beforehand or together with this task. In my opinion #120 should also be included in the same milestone.
Additionally, moving to syn2
seems like a big endeavor:
- Since the
serde-derive-internals
parser seems to be consuming the input, we'd need to perform two parsing passes. One performed byserde-derive-internals
, one performed by our own parser. - We should mimic a similar structure that
serde-derive-internals
has i.e. aContainer
struct maybe implementing theParse
trait, which would parse a givenstruct
orenum
and provide accessors to all the required#[typeshare(...)]
annotations, both on the wholeContainer
as well as the fields or variants.
After both passes - by serde-derive-internals
and our own parser - we'd need to merge both results into a single one based on the struct/enum/field idents.
At this moment I don't see any way to perform this operation in steps. This means that the parser should probably be rewritten from scratch in one go.