decode

Undocumented in source. Be warned that the author may not have intended to support it.
T
decode
(
T
)
(
ubyte[] encoded
)

Examples

struct Foo
{
  @ProtoTag(1) int a;
  @ZigZag @ProtoTag(2) int b;
  @ProtoTag(3) pstring c;
}

ubyte[] encoded = [
    /* tag(1), varint(0) */ 0x08, /* 1 */ 0x01,
    /* tag(2), varint(0) */ 0x10, /* 1 but -1 in zigzag */ 0x01,
    /* tag(3), length-delim */ 0x1a, /* len(3)*/ 03, /* abc */ 0x61, 0x62, 0x63];
auto foo = decode!Foo(encoded);
assert(foo == Foo(1, -1, pstring("abc")));

Meta