Skip to content

Allow dynamic nested types #78

@Swoorup

Description

@Swoorup

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>>,
}

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