Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement Serialize and Deserialize on ParseError #386
Conversation
|
r? @SimonSapin |
|
I updated the ticket name to reflect that it does both |
| /// Deserializes this ParseError from a `serde` stream. | ||
| impl<'de> Deserialize<'de> for De<ParseError> { | ||
| fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de> { | ||
| enum Variant { |
This comment has been minimized.
This comment has been minimized.
Hoverbear
Aug 29, 2017
Member
I'm a bit unhappy with the level of duplication here. Is there maybe some way we can reduce the amount of times we list all the variants? In the interest of maintainability it would be great to only need to change the code in one (or two) spots when we add a variant. At the moment it seems like we need to do it in at least 6 places.
This comment has been minimized.
This comment has been minimized.
KiChjang
Aug 29, 2017
Author
Member
The duplication here is mostly because of my own lack of knowledge of how serde works. I have no idea how the implementation body of ParseErrorVisitor would look otherwise.
This comment has been minimized.
This comment has been minimized.
KiChjang
Aug 29, 2017
Author
Member
Also, I'm under the impression that url_serde is only a temporary fix until we upgrade to serde 1.0 on master, so I guess this is fine for now?
|
|
|
|
KiChjang commentedAug 6, 2017
•
edited by larsbergstrom
This change is