Skip to content

Allow dynamic nested types #78

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

Open
Swoorup opened this issue May 3, 2025 · 0 comments
Open

Allow dynamic nested types #78

Swoorup opened this issue May 3, 2025 · 0 comments

Comments

@Swoorup
Copy link

Swoorup commented May 3, 2025

It would be nice to get support for HashMap, for eg.

#[derive(Debug, PartialEq, StructOfArray)]
#[soa_derive(Debug, PartialEq)]
struct Baz {
    foo: u16,
    bar: u8,
    test: HashMap<u16, u8>,
}

would create

struct BazVec {
    #[doc = r" a vector of `"]
    #[doc = stringify!(foo)]
    #[doc = r"` from a"]
    #[doc = "[`Baz`](struct.Baz.html)"]
    pub foo: Vec<u16>,
    #[doc = r" a vector of `"]
    #[doc = stringify!(bar)]
    #[doc = r"` from a"]
    #[doc = "[`Baz`](struct.Baz.html)"]
    pub bar: Vec<u8>,
    #[doc = r" a vector of `"]
    #[doc = stringify!(test)]
    #[doc = r"` from a"]
    #[doc = "[`Baz`](struct.Baz.html)"]
    pub test: HashMap<u16, Vec<u8>>,
}

instead of the current

struct BazVec {
    #[doc = r" a vector of `"]
    #[doc = stringify!(foo)]
    #[doc = r"` from a"]
    #[doc = "[`Baz`](struct.Baz.html)"]
    pub foo: Vec<u16>,
    #[doc = r" a vector of `"]
    #[doc = stringify!(bar)]
    #[doc = r"` from a"]
    #[doc = "[`Baz`](struct.Baz.html)"]
    pub bar: Vec<u8>,
    #[doc = r" a vector of `"]
    #[doc = stringify!(test)]
    #[doc = r"` from a"]
    #[doc = "[`Baz`](struct.Baz.html)"]
    pub test: Vec<HashMap<u16, u8>>,
}
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

No branches or pull requests

1 participant