Skip to content
FutureBlitz

    Install

    Import std.data.msgpack

    std.data.msgpack

    MessagePack, as its spec has it: MessagePack.Read gives the Value of a document's bytes, and MessagePack.Write gives a Value's, each integer, string, and container in the fewest bytes its kind has. Both go through arrays and maps with no call for each, so depth costs nothing.

    std/data/msgpack.fb

    Types

    MessagePack struct

    Public Struct MessagePack

    A document's Value, and a Value's document.

    std/data/msgpack.fb, line 17

    • @PanicsAtCaller Public Static Method Read(data: UInt8[], depth: Int = DEPTH): Value Throws ParseError static method #

      The Value of data's MessagePack: nil as NULL, a bool as BOOL, an integer that fits an Int64 as an INT and a larger one as a UINT, a float 32 or 64 as a DOUBLE, a str as a STRING, a bin as BYTES, an array as an ARRAY, and a map as an OBJECT, its keys in order, the last of a key that repeats where its first was. Throws a ParseError, whose message says at which byte: SYNTAX for the byte 0xC1, which starts no value, a str that isn't UTF-8, or bytes after the value; UNEXPECTED_END for data that ends too soon, or says it has more than it does; WRONG_TYPE for a map's key that isn't a str, or an ext, which a Value has no kind for; and OUT_OF_RANGE for arrays and maps nested past depth. Panics unless depth is 1 or more.

    • Public Static Method Write(value: Value): UInt8[] static method #

      value's MessagePack: an integer in the fewest bytes of a fixint, a uint, or an int, a DOUBLE as a float 64, a STRING as a str and BYTES as a bin, and an ARRAY and an OBJECT as an array and a map, each with its count in the fewest bytes.

    • @PanicsAtCaller Public Static Method Read<T>(data: UInt8[], depth: Int = DEPTH): T Throws ParseError static method #

      The T of data's MessagePack: Read's Value, made a T by Load<T>. Throws Read's ParseErrors, and Load's, whose Path says where in the document a value doesn't fit.

    • @PanicsAtCaller Public Static Method Write<T>(x: T): UInt8[] static method #

      x's MessagePack: Save's Value of it, written as Write writes a Value.

    Report an issue with this page or with FutureBlitz on GitHub.