Skip to content

Document examples of using nested Structs and Unions with DataclassMixin #10

@lindblandro

Description

@lindblandro

I'm trying to convert old construct code to be more readable and DataclassMixin seems the way to do it. However, I converting nested structures into dataclass instances is a bit hazy for me at the moment. Is it possible to describe a structure like

Struct(
    "field" / Int8ub,
    "foo" / Union(
        "bar" / Int24ub,
        "baz" / Struct(
            "a" / Int8ub,
            "b" / Int8ub,
            "c" / Int8ub
        )
    )
)

into a DataclassMixin?

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