Skip to content

Pass all childs types to enum? #16

@dragonnn

Description

@dragonnn

I somehow possible to skip the child definition and just for example use:

#[xml(child = "*")]
childs: Vec<All>,

or

#[xml(childall)]
childs: Vec<All>,

I have an enum like that:

#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
pub enum All {
    #[xml(tag = "Figura")] Figure(Figure),
    #[xml(tag = "Pomiar")] Measurement(Measurement),
    #[xml(tag = "Wyswietlacz")] Display(Display),
    #[xml(tag = "Grupa")] Group(Group),
    #[xml(tag = "GrupaObiektow")] GroupObjects(GroupObjects),
    #[xml(tag = "Opis")] Desc(Desc),
}

And doing:

#[xml(child = "Figura", child = "Pomiar", child = "Wyswietlacz", child = "Grupa", child="GrupaObiektow", child="Opis")]
childs: Vec<All>,

Is just double work, or even in my case four times repeating that same thing because Group and GroupObjects also contain child's. The enum have all information need to parse child's, and it could just return some error "VariantNotFound" when an unknown child appears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions