Skip to content

Releases: kj4tmp/lizpack

v0.4.1

30 Dec 08:26
Compare
Choose a tag to compare
  • fixes default format of vectors, arrays of u8 to be .str

v0.4.0

30 Dec 08:10
Compare
Choose a tag to compare
  • removes encodeCustom / decodeCustom API in favor of .{} in encode() / decode() function signatures
  • adds format customization for vectors, similar to arrays
  • fixes bug in singed integer serialization

v0.3.0

29 Dec 06:39
Compare
Choose a tag to compare
  • Added zero error encoding API via encodeCustomBounded() which encodes into a bounded array.

v0.2.0

28 Dec 21:59
Compare
Choose a tag to compare

v0.2.0 adds a ton of new features!.

  • Decode and encode variable length data structures (slices etc.) using an allocator.
  • Customize the format of types that could correspond to multiple MessagePack Types.

Default Formats

Zig Type MessagePack Type
bool bool
null nil
u3,u45, i6 integer
?T nil or T
enum integer
[N]T N length array of T
[N:x]T N+1 length array of T ending in x
[N]u8 str
@Vector(N, T) N length array of T
struct map, str: field value
union (enum) map (single key-value pair)
[]T N length array of T
[:x]T N + 1 length array of T ending in x
[]u8 str
[:x]u8 str ending in x
*T T

str is the default MessagePack type for []u8 because it is the smallest for short slices.

Unsupported types:

Zig Type Reason
union (untagged) Decoding cannot determine active field, and neither can you.
error I can add this, if someone asks. Perhaps as str?

Note: pointer types require allocation to decode.

Customizing Formats

You can customize how types are formatted in message pack:

Zig Type Available Encodings
enum string, int
[]u8,[N]u8 string, int, array
struct map, array
union (enum) map (single key-value pair), active field

See examples for how to do it.

v0.1.0

23 Dec 09:54
Compare
Choose a tag to compare

First release