lmpl4d 0.0.4

Lightweight MessagePack library for D


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

lmpl4d

Lightweight MessagePack library for D

Features

  • Small size and high performance
  • Supports D features (Ranges, Tuples, real type)

Usage

import lmpl4d;

struct S { int id; string name; double size; }

ubyte[] buf;
auto data = packer(buf);
data.pack(42);
data.pack(null, true, 1u);
data.pack([1, 2, 3]);
data.pack(["foo": "bar"]);
data.pack(S(2, "foo", 7.5));
data.packArray(true, 1);  // -> [true, 1]
data.packMap("Hi", 100);  // -> ["Hi":100]
auto p = unpacker(data[]);
assert(p.unpack!int == 42);
assert(p.unpack!(int[]) == []);
assert(p.unpack!bool);
assert(p.unpack!uint == 1);
assert(p.unpack!(uint[])); // implicitly converts int[] to uint[]
assert(p.unpack!(string[string]));

nonPacked attribute

Skip serialization/deserialization of a specific field

struct User
{
    string name;
    @nonPacked int id;  // pack / unpack will ignore the 'id' field
}
Authors:
  • 0-v-0
Dependencies:
none
Versions:
0.0.6 2022-May-09
0.0.5 2022-May-08
0.0.4 2022-Apr-26
0.0.3 2022-Apr-10
0.0.2 2022-Apr-06
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 14 downloads total

Score:
0.3
Short URL:
lmpl4d.dub.pm