Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upImprove derive functionality (skip and defaults) #1574
Comments
theduke
changed the title from
Improve derive functionality
to
Improve derive functionality (skip and defaults)
Feb 25, 2018
This comment has been minimized.
|
Duplicate of #860. |
sgrif
closed this
Feb 26, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
theduke commentedFeb 25, 2018
•
edited
I often want a few tweaks to the various derivable traits that would improve quality of life quite a bit.
They are mostly inspired by serde_derive, which has similar features.
If this is ok with the maintainers, I'd start working on a PR for this.
Skip
Allow skipping of fields for
AsChangesetandInsertable.A plain skip would already be useful.
What would be even more useful is selective skipping eg only for updates.
Default
Attribute names
It seems to be an established practice to wrap attributes with the crate name to be more specific, a la
serde(...), ...It's somewhat ok for things like
table_nameandprimary_key, butnot really for
defaultandskip, since they are so generic.So i'd propose wrapping for those.
Actually, I'd also propose adding new variants for the existing attributes, and maybe at some point deprecating the old ones, but that's another discussion.