Skip to main content

similar function to the builtin struct-library but more efficient

Project description

structlib-py

similar function to the builtin struct-library but more efficient

import structlib as sl

@dataclasses.dataclass
class MyStruct(sl.Structure):
    name: Annotated[str, sl.String(10))]
    value: int

sl.dumps(MyStruct("Hello World", 10))
MyStruct.struct_dumps(binary/stream)
b'\x12Hello World\x10'
sl.loads(binary/stream, type=MyStruct)
MyStruct.struct_load(binary/stream)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

structurelib-0.0.0.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

structurelib-0.0.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page