Skip to content

Iterate over syn's structs fields #1965

@sagi21805

Description

@sagi21805

Implementing custom traits on syn's structs is very useful, and sometimes those function could be really repeatable.

if there was an iterator over the names of the fields of syn's structs, it could help creating a macro for those function, so they won't be repeated.

If it is in the project will, I would like to work on this, hopefully it would behave like this:

#[derive(IterFields)]
struct Example {
    a: u32,
    b: u32,
    c: u32,
}

impl IterFields for Exmple {
    const FIELDS: [&'static str; 3] = ["a", "b", "c"]
}

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