Skip to content

Releases: kj4tmp/lizpack

v0.7.2

06 Mar 04:57
Compare
Choose a tag to compare
  • Officially support zig 0.14.0

v0.7.1

03 Mar 01:59
Compare
Choose a tag to compare
  • update due to breaking changes to zig master

v0.7.0

23 Jan 09:21
Compare
Choose a tag to compare
  • adds lizpack.manual for finest possible control over encoding and decoding
  • renames lizpack.Spec to lizpack.spec

v0.6.0

21 Jan 06:25
Compare
Choose a tag to compare
  • adds encodeAlloc() API, which allocates as many bytes as needed to encode to MessagePack.

v0.5.1

17 Jan 21:08
Compare
Choose a tag to compare
  • Fixes build on zig master have changes to std.builtin.Type

v0.5.0

13 Jan 10:39
Compare
Choose a tag to compare
  • Added support for encoding / decoding arrays of two-field structs as message pack maps. See examples for how to do it.

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.