msgpack

MessagePack binary serialization for Kit

Files

FileDescription
kit.tomlPackage manifest with metadata and dependencies
src/msgpack.kitMessagePack encoding, decoding, and value accessors
tests/msgpack.test.kitTests for all value types and nested structures
examples/basic.kitEncode and decode maps, arrays, and nested data
examples/comparison.kitCompare MessagePack vs JSON serialization sizes
LICENSEMIT license file

Dependencies

No Kit package dependencies.

Installation

kit add gitlab.com/kit-lang/packages/kit-msgpack.git

Usage

import Kit.Msgpack

License

MIT License - see LICENSE for details.

Exported Functions & Types

MsgPackError

MsgPack error type for typed error handling.

Variants

MsgPackDecodeError {message}
MsgPackFormatError {message}

MsgPack

Marker type for the MessagePack format. Used with BinaryEncode/BinaryDecode traits to distinguish MessagePack serialization.

Variants

MsgPack

Value

MessagePack value representation

Variants

MsgNil
MsgBool {Bool}
MsgInt {Int}
MsgFloat {Float}
MsgString {String}
MsgBinary {List, Int}
MsgArray {List, Value}
MsgMap {List}
MsgExt {Int, List, Int}

encode

Value -> List Int

decode

List Int -> Result Value MsgPackError

nil

Value

bool

Bool -> Value

int

Int -> Value

float

Float -> Value

string

String -> Value

binary

List Int -> Value

array

List Value -> Value

map

List (String, Value) -> Value

ext

Int -> List Int -> Value

to-bytes

Value -> List Int

from-bytes

List Int -> Result Value MsgPackError

pack

Value -> String

unpack

String -> Result Value MsgPackError

is-nil?

Value -> Bool

is-bool?

Value -> Bool

is-int?

Value -> Bool

is-float?

Value -> Bool

is-string?

Value -> Bool

is-binary?

Value -> Bool

is-array?

Value -> Bool

is-map?

Value -> Bool

is-ext?

Value -> Bool

as-bool

Value -> Option Bool

as-int

Value -> Option Int

as-float

Value -> Option Float

as-string

Value -> Option String

as-binary

Value -> Option (List Int)

as-array

Value -> Option (List Value)

as-map

Value -> Option (List (String, Value))

get

Value -> String -> Option Value

at

Value -> Int -> Option Value