diff --git a/struct/struct.py b/struct/struct.py new file mode 100644 index 00000000..74ed9038 --- /dev/null +++ b/struct/struct.py @@ -0,0 +1,13 @@ +from ustruct import * + +class Struct: + + def __init__(self, format): + self.format = format + self.size = calcsize(format) + + def unpack(self, buf): + return unpack(self.format, buf) + + def pack(self, *vals): + return pack(self.format, *vals)