I'm trying to figure out how to add raw bytes the packed stream in msgpack-d. My current try is

import std.stdio;
import std.conv: to;
import std.container: Array;
import msgpack;

static void stringArrayPackHandler(E)(ref Packer p,
                                      ref Array!E x)
{
    // p.put(192);
    /* p.packArray(x); */
    foreach (e; x)
        p.pack(e);
}

unittest
{
    registerPackHandler!(Array!string, stringArrayPackHandler);
    Array!string x = ["x", "y"];
    writeln(x.pack);
    writeln(["x", "y"].pack);
}

which outputs

[161, 120, 161, 121]
[146, 161, 120, 161, 121]

How do I add the leading byte 146?

Reply via email to