Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support with on magic field attrs #273

Closed
TedDriggs opened this issue Feb 23, 2024 · 0 comments · Fixed by #274
Closed

Support with on magic field attrs #273

TedDriggs opened this issue Feb 23, 2024 · 0 comments · Fixed by #274
Assignees

Comments

@TedDriggs
Copy link
Owner

In colin-kiegel/rust-derive-builder#310, @dtolnay pointed out some clunky code that handles “distribution and unnesting” of attributes. The Options struct is forced to have an attrs field that is only temporarily used.

This can be avoided by allowing the deriver of FromDeriveInput et alia to provide a conversion function that takes attributes and returns a darling::Result<?>

This function must participate in the error accumulator behavior of the rest of the derived impl, so it must be invoked before the error check, and we’ll need a new local variable for the output.

with makes more sense than the postfix items, since this must allow failure and doesn’t itself take in a Result

@TedDriggs TedDriggs self-assigned this Feb 23, 2024
TedDriggs added a commit that referenced this issue Feb 23, 2024
This allows the `attrs` magic field to have any type, rather than being limited to `Vec<Attribute>`.

Fixes #273
TedDriggs added a commit that referenced this issue Feb 23, 2024
This allows the `attrs` magic field to have any type, rather than being limited to `Vec<Attribute>`.

Fixes #273
TedDriggs added a commit that referenced this issue Feb 23, 2024
This allows the `attrs` magic field to have any type, rather than being limited to `Vec<Attribute>`.

Fixes #273
TedDriggs added a commit that referenced this issue Feb 23, 2024
This allows the `attrs` magic field to have any type, rather than being limited to `Vec<Attribute>`.

Fixes #273
TedDriggs added a commit that referenced this issue Feb 23, 2024
This allows the `attrs` magic field to have any type, rather than being limited to `Vec<Attribute>`.

Fixes #273
TedDriggs added a commit that referenced this issue Feb 23, 2024
This allows the `attrs` magic field to have any type, rather than being limited to `Vec<Attribute>`.

Fixes #273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant