Changelog
All notable changes to @craftycodie/cstruct are documented here.
[1.1.0] — 2026-05-26
This update addresses inconsistencies in the API Bitfield API.
Changed
- Bitfields are now
c.CBitfieldadvanced fields (c.AdvancedType) instead of a separate field kind- Generally speaking, we intend to keep anything not native to C as an AdvancedType.
Removed
- Removed "standalone" Bitfield functions for reading bitfield values outside of a cstruct.
- Public
bitfield_from_raw/bitfield_to_rawhelpers (usec.read/c.writeon a struct field) BitfieldFieldtype alias andcreate_bitfield_field()factory- Reading individual fields is currently outside of the scope of cstruct.
- Public
[1.0.0] — 2026-05-25
Initial release.
Layouts
- Struct —
@c.struct()/@c.field()withc.read,c.write, andc.sizeof - Union — discriminated unions with
@c.union,c.arm, andc.when - Enum —
c.enum()integer slots with validated values - Bitfield —
c.bitfield()flag words packed into a primitive - Array — fixed-length
@c.field(..., { count })andc.array()
Advanced fields
c.Time64()— Unix timestamp asDatec.String(n)— fixed-size Latin-1 stringc.WString(n)— fixed-size UTF-16LE wide stringc.Bool()— one-byte boolean
Custom encodings via c.AdvancedType are also supported.