Skip to content

Deserialize enums by attribute (similar to SerDe tag attribute) #195

@gtemkin

Description

@gtemkin

Is it possible to deserialize enums by an attribute, not by name, similar to what SerDe tag attribute does?

<parent>
  <child type="A" attr1="" attr2=""/>
  <child type="B" attr3="" attr4=""/>
</parent>
struct Parent {
  children: Vec<Child>
}

enum Child {
  A { attr1: String, attr2: String },
  B { attr3: String, attr4: String }
}

I have a lot of those Child elements, they all share about 3 attributes, but have all other attributes and inner elements are different, so it is hard to create a common structure that cover them all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions