#struct #parser #deserialize #python #ad-hoc #module #pack

nightly macro strukt

strukt is an implementation of Python's struct module for ad-hoc [de]serialization

1 unstable release

Uses old Rust 2015

0.1.0 Jun 28, 2017

#23 in #ad-hoc

MIT/Apache

7KB
66 lines

strukt

strukt is a library for ad-hoc [de]serialization inspired by Python's struct module.

Examples

pack!(">H")(1337) == [5, 57]
pack!("<Q")(0x41424344) == b"DCBA\0\0\0\0"
pack!("<hhI")(-1, 2, 42) == b"\xff\xff\x02\x00\x2a\x00\x00\x00"

Dependencies

~3.5MB
~73K SLoC