c-like struct implementation for human
Project description
pystructs
pystructs
is useful c-like struct
package for human
How to install
$ pip install pystructs
Example codes
from typing import List
from pystructs import fields
class Attribute(fields.Struct):
type = fields.BytesField(size=1)
length = fields.Int32Field(byteorder='big')
value = fields.VariableBytesField(related_field='length')
class StunMessage(fields.Struct):
type = fields.BytesField(size=1)
length = fields.Int32Field(byteorder='big')
attributes: List[Attribute] = fields.MultipleField(count='length', field=Attribute())
message = StunMessage(<bytes>)
message.initialize()
# Just use!
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
pystructs-0.2.1.tar.gz
(5.0 kB
view hashes)