Skip to content

vikingfacer/ziggypack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ziggy Pack

testing workflow MIT License Ziggy Pack is a message pack library for zig written is zig. Ziggy Pack uses compile time reflection to get buffer size, pack and (soon)unpack.

Basic usage

const std = @import("std");
const pack = @import("ziggy-pack.zig");

const testmsg = struct {
    a: [5]u32 = [_]u32{
    f: bool = false,
    nil: @Type(.Null) = null,
    int32: i32 = -3,
    unt64: u64 = 4,
};

pub fn main() !u8 {
    const testmsg1 = testmsg{};
    // get the size of the buffer you'll need
    const ps = pack.packSize(testmsg1);
    var a = [_]u8{0} ** ps;

    // pack the struct
    var i: usize = 0;
    pack.pack(a[0..a.len], &i, testmsg1);

    return 0;
}

what is done?

pack

  • nil
  • false
  • true
  • float-32
  • float-64
  • uint-8
  • uint-16
  • uint-32
  • uint-64
  • int-8
  • int-16
  • int-32
  • int-64
  • fixstr(needs testing)
  • str-8(needs testing)
  • str-16(needs testing)
  • str-32(needs testing)
  • fixarray(needs testing)
  • array-16(needs testing)
  • array-32(needs testing)
  • fixmap(needs testing)
  • map-16(needs testing)
  • map-32(needs testing)

unpack (not implemented)

  • nil
  • false
  • true
  • float-32
  • float-64
  • uint-8
  • uint-16
  • uint-32
  • uint-64
  • int-8
  • int-16
  • int-32
  • int-64
  • fixstr
  • str-8
  • str-16
  • str-32
  • fixarray
  • array-16
  • array-32
  • fixmap
  • map-16
  • map-32

Is not implemented and will not be implemented

  • positive-fixint
  • negative-fixint
  • (never-used)
  • bin-8
  • bin-16
  • bin-32
  • ext-8
  • ext-16
  • ext-32
  • fixext-1
  • fixext-2
  • fixext-4
  • fixext-8
  • fixext-16

About

msgpack for zig experimental

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published