Skip to content

zig messagpack implementation / msgpack.org[zig]

License

Notifications You must be signed in to change notification settings

zigcc/zig-msgpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MessagePack for Zig

This is an implementation of MessagePack for Zig.

an article introducing it: Zig Msgpack

Features

  • Supports all MessagePack types(except timestamp)
  • Efficient encoding and decoding
  • Simple and easy-to-use API

NOTE

The current protocol implementation has been completed, but it has not been fully tested. Only limited unit testing has been conducted, which does not cover everything.

Getting Started

0.11

  1. Add to build.zig.zon
.@"zig-msgpack" = .{
        // It is recommended to replace the following branch with commit id
        .url = "https://github.com/zigcc/zig-msgpack/archive/{commit or branch}.tar.gz",
        .hash = <hash value>,
    },
  1. Config build.zig
const msgpack = b.dependency("zig-msgpack", .{
    .target = target,
    .optimize = optimize,
});

// add module
exe.addModule("msgpack", msgpack.module("msgpack"));

0.12 \ 0.13 \ nightly

  1. Add to build.zig.zon
zig fetch --save https://github.com/zigcc/zig-msgpack/archive/{commit or branch}.tar.gz
# Of course, you can also use git+https to fetch this package!
  1. Config build.zig
// To standardize development, maybe you should use `lazyDependency()` instead of `dependency()`
const msgpack = b.dependency("zig-msgpack", .{
    .target = target,
    .optimize = optimize,
});

// add module
exe.root_module.addImport("msgpack", msgpack.module("msgpack"));

Related projects