Skip to content

Feat: allow extracting multiple children names into one field #8

Open
@CAD97

Description

e.g. I have

#[derive(knuffel::Decode)]
pub struct Config {
    #[knuffel(children(name = "replace"))]
    pub replace: Vec<ReplaceRegex>,
    #[knuffel(children(name = "job"))]
    pub jobs: Vec<Job>,
}

It turns out that a lot of replace rules end up being used in practice, and I'd like to allow the use of r as a shorthand. With current knuffel, I'd have to do this as a separate field. I would instead like to do something like the following:

#[derive(knuffel::Decode)]
pub struct Config {
    #[knuffel(children(name = "replace", name = "r"))]
    pub replace: Vec<ReplaceRegex>,
    #[knuffel(children(name = "job"))]
    pub jobs: Vec<Job>,
}

and both replace and r children will go into self.replace.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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