Skip to content

Handling errors is flattened structs validation #294

Closed Answered by TedDriggs
Techassi asked this question in Q&A
Discussion options

You must be logged in to vote

Magic fields like ident don’t work with flatten, so even if the types were identical you wouldn’t be able to do what’s depicted here.

In my opinion, a better solution would be to change ItemAttributes::my_common_attr to be a SpannedValue<String> or a syn::LitStr so you have the span of that specific field, and put the error there rather than being on the variant or field ident.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Techassi
Comment options

Answer selected by Techassi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants