Skip to content

Abandon the _fields_ syntax in lieu of defining class-level properties #3

@kendas

Description

@kendas

The preservation of order should be possible. This behavior can be observed in Django's models.

The new format should change from this:

class DefaultValuePacket(SerdepaPacket):
    _fields_ = [
        ("header", nx_uint8, 1),
        ("version", nx_uint8),
        ("timestamp", nx_uint32, 12345),
        ("length", Length(nx_uint8, "data")),
        ("data", List(nx_uint8), [1, 2, 3, 4]),
        ("tail", List(nx_uint8), [5, 6])
]

to this:

class DefaultValuePacket(SerdepaPacket):
    header = nx_uint8(1)
    version = nx_uint8
    timestamp = nx_uint32(12345)
    length = Length(nx_uint8, "data")
    data = List(nx_uint8, [1, 2, 3, 4]),
    tail = List(nx_uint8, [5, 6])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions