Skip to content

Descriptive struct #21

@vallsv

Description

@vallsv

When i saw your library, i was searching something to define cstrucs as descriptive way.

With the last python typing annotation there is probably way to provide something like that:

class Foo(pycstruct.Struct):
    foo: pycstruct.uint32
    foo2: pycstruct.uint16
    foo3: pycstruct.array[pycstruct.float64, 32]

...or...

class Foo:
    foo: typing.Annotated[int, pycstruct.type("uint32")]
    foo2: typing.Annotated[int, pycstruct.type("uint16")]
    foo3: typing.Annotated[float, pycstruct.type("float64, length=32")]

...or...

class Foo:
    @pycstruct.tpye("uint32")
    foo: int
    @pycstruct.tpye("uint16")
    foo2: int
    @pycstruct.tpye("uint16", length=32)
    foo3: float

No idea if that stuff could work or not.

I would be very happy to use such thing.
Do you think it could interest you?

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