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

Add enum fields and tuple length to deserialization visitor methods, renamed some more methods #120

Merged
merged 13 commits into from Jul 30, 2015

Conversation

2 participants
@erickt
Member

erickt commented Jul 29, 2015

Some more bits inspired by #114.

This adds the expected length of tuples, tuple structs, and tuple variants to the visitors as well as adds the variant names to the visit_enum method. Also renames VariantVisitor::visit_{map,seq} to visit_{struct,tuple} as well as renaming Serializer::visit_enum_{unit,map,seq} to visit_{unit,struct,tuple}_variant to be consistent with the other methods.

cc @oli-obk, @tomprogrammer, @hugoduncan

Show outdated Hide outdated serde/src/de/impls.rs
Show outdated Hide outdated serde/src/ser/impls.rs
@erickt

This comment has been minimized.

Show comment
Hide comment
@erickt

erickt Jul 30, 2015

Member

@oli-obk: I updated the PR to include also changing visit_enum_simple to pass in the variant index as well as switched to using it for the Result<T, E> serializer.

Member

erickt commented Jul 30, 2015

@oli-obk: I updated the PR to include also changing visit_enum_simple to pass in the variant index as well as switched to using it for the Result<T, E> serializer.

@oli-obk

This comment has been minimized.

Show comment
Hide comment
@oli-obk

oli-obk Jul 30, 2015

Member

So, a hypothetical format could serialize the variant id only, deserialize it, and use the variant names array to find the name, and then pass that name as the variant name. We seriously need some documentation someday on "how to ser/de your own format".

LGTM

Member

oli-obk commented Jul 30, 2015

So, a hypothetical format could serialize the variant id only, deserialize it, and use the variant names array to find the name, and then pass that name as the variant name. We seriously need some documentation someday on "how to ser/de your own format".

LGTM

@erickt

This comment has been minimized.

Show comment
Hide comment
@erickt

erickt Jul 30, 2015

Member

@oli-obk: Updated the pr to also include having Result<T, E> deserialize from a simple enum, and added a few more tests.

Member

erickt commented Jul 30, 2015

@oli-obk: Updated the pr to also include having Result<T, E> deserialize from a simple enum, and added a few more tests.

@erickt

This comment has been minimized.

Show comment
Hide comment
@erickt

erickt Jul 30, 2015

Member

@oli-obk: totally agree on the documentation. serde is a bit of a beast :/

Member

erickt commented Jul 30, 2015

@oli-obk: totally agree on the documentation. serde is a bit of a beast :/

erickt added a commit that referenced this pull request Jul 30, 2015

Merge pull request #120 from erickt/enum-fields
Add enum fields and tuple length to deserialization visitor methods, renamed some more methods

@erickt erickt merged commit 7e25ed8 into serde-rs:master Jul 30, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment