-
-
Notifications
You must be signed in to change notification settings - Fork 827
Support (de)serialize_with in tuples #335
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
Conversation
@@ -177,31 +177,29 @@ pub struct FieldAttrs { | |||
name: Name, | |||
skip_serializing_field: bool, | |||
skip_deserializing_field: bool, | |||
skip_serializing_field_if: Option<P<ast::Expr>>, | |||
skip_serializing_if: Option<ast::Path>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc the idea was to allow arbitrary expressions in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Given that it's not on our roadmap (no issue for it) and I am not convinced that it would be a valuable thing to support, I do no think we should keep around a lot of convoluted dead code in the hope that some day it will be useful.
I rebased to fix the merge conflict with #338. We both added something to the bottom of serde_tests/tests/test_gen.rs. |
The travis failure is clippy doesn't build. |
I think I grokked most of the code now.
agreed on both points. We should probably add cfail tests some day to test for behavior we don't want. @homu r+ |
Support (de)serialize_with in tuples Fixes #330 and a number of related bugs around (de)serialize_with in newtype structs, tuple structs, newtype variants, and tuple variants. The most interesting thing in this PR is a significantly condensed version of `wrap_serialize_with`. It now works a lot more like `wrap_deserialize_with`, with just a thin wrapper that provides a `serialize` method. Please confirm that the contortions in the original implementation were not necessary. I had to make this change to support serialize_with in newtype structs and newtype variants.
hmmm right... well... it looks like clippy is going to work again soon, I'll postpone instead of merging manually |
I filed #341 to add cfail tests. The clippy PR we need to watch is https://github.com/Manishearth/rust-clippy/pull/944, going to be published as 0.0.69. |
@dtolnay done |
Merging because I retriggered the Travis build and it passed. |
Fixes #330 and a number of related bugs around (de)serialize_with in newtype structs, tuple structs, newtype variants, and tuple variants.
The most interesting thing in this PR is a significantly condensed version of
wrap_serialize_with
. It now works a lot more likewrap_deserialize_with
, with just a thin wrapper that provides aserialize
method. Please confirm that the contortions in the original implementation were not necessary. I had to make this change to support serialize_with in newtype structs and newtype variants.