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

(De)serializtion for enums with unnamed fields #30

Merged

Conversation

DmitrySamoylov
Copy link
Contributor

Hey!
I've added (de)serialization for enums with unnamed fields.

  #[derive(YaSerialize, PartialEq, Debug)]
  pub enum Enum {
    Simple,
    Field(String),
    FullPath(std::string::String),
    Integer(i32),
    UserStruct(OtherStruct),
    OptionString(Option<String>),
    OptionUserStruct(Option<OtherStruct>),
    Strings(Vec<String>),
    Ints(Vec<i32>),
    Structs(Vec<OtherStruct>),
    #[yaserde(rename = "renamed")]
    ToRename(u32),
  }

Now almost all types of enum fields are supported:

\ Unit Named Unnamed
Ser v x v
De v v v

@coveralls
Copy link

coveralls commented Dec 31, 2019

Pull Request Test Coverage Report for Build 98

  • 102 of 176 (57.95%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+5.6%) to 42.193%

Changes Missing Coverage Covered Lines Changed/Added Lines %
yaserde/tests/serializer.rs 51 53 96.23%
yaserde_derive/src/de/expand_struct.rs 0 4 0.0%
yaserde_derive/src/ser/expand_enum.rs 0 32 0.0%
yaserde_derive/src/de/expand_enum.rs 0 36 0.0%
Totals Coverage Status
Change from base Build 95: 5.6%
Covered Lines: 789
Relevant Lines: 1870

💛 - Coveralls

@MarcAntoine-Arnaud MarcAntoine-Arnaud merged commit 3771a95 into media-io:master Jan 8, 2020
@MarcAntoine-Arnaud
Copy link
Contributor

Thank you ! Do you need a new package release with it ?

@MarcAntoine-Arnaud
Copy link
Contributor

Can we check on the README the Enum with complex types support ?

@DmitrySamoylov
Copy link
Contributor Author

Thank you ! Do you need a new package release with it ?

Yeah, that would be cool.

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

Successfully merging this pull request may close these issues.

None yet

4 participants