File: simple.d

package info (click to toggle)
sambamba 1.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,900 kB
  • sloc: javascript: 552; sh: 220; python: 166; ruby: 147; makefile: 104; lisp: 85
file content (27 lines) | stat: -rw-r--r-- 507 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Written in the D programming language.

/**
 * Serializer and Stream Deserializer usage
 */

import std.array;
import std.stdio;

import msgpack;


void main()
{
    auto packer = packer(appender!(ubyte[])());

    packer.packArray(null, true, "Hi!", -1, [1, 2], '!');

    auto unpacker = StreamingUnpacker(packer.stream.data);

    if (unpacker.execute()) {
        foreach (obj; unpacker.purge())
            writeln(obj.type);
    } else {
        writeln("Serialized object is too large!");
    }
}