lmpl4d 0.0.12
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
}
- Registered by Li Junxiang
- 0.0.12 released 10 months ago
- 0-v-0/lmpl4d
- MIT
- Copyright © 2021-2024, 0-v-0
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.13 2024-Jan-24 0.0.12 2024-Jan-23 0.0.11 2023-Nov-24 0.0.10 2023-Sep-27 0.0.9 2023-Aug-19 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
102 downloads total
-
- Score:
- 1.1
- Short URL:
- lmpl4d.dub.pm