babbel_msgpack
Fast, binary-safe MessagePack parser, serializer, and FormatEngine in pure Rust with zero external runtime dependencies.
Features
- Full Specification Support: Encodes and decodes all standard MessagePack types:
- FixInt, UInt 8/16/32/64, Int 8/16/32/64
- Nil, Boolean (
false/true) - Float 32 / Float 64
- FixStr, Str 8/16/32 (validated UTF-8)
- Bin 8/16/32 (
Value::Bytes) - FixArray, Array 16/32 (
Value::Array) - FixMap, Map 16/32 (
Value::Object) - FixExt 1/2/4/8/16, Ext 8/16/32
- Universal AST: Maps 1:1 with Babbel's
Value. - Security & DoS Protection: Built-in maximum recursion depth (default 128) and payload size limit (default 64 MB).
- Zero Heavy Dependencies: Pure Rust implementation matching Babbel's lightweight footprint.
- OCP & DIP Architecture: Implements
FormatEngine, allowing dynamic registration intobabbel::FormatRegistryand instant cross-format conversion.
Usage
[]
= "0.3.0"
Parsing and Serializing
use ;
use ;
let data = Object;
// Encode to MessagePack binary
let bytes = to_vec?;
// Decode back to universal Value AST
let decoded = from_bytes?;
assert_eq!;
// Use via FormatEngine trait
let engine = MsgPackEngine;
let bytes2 = engine.serialize_to_vec?;
let decoded2 = engine.parse_bytes?;
assert_eq!;
# Ok::
Examples
Run any of the included examples with cargo:
# Basic parse, serialize, and AST exploration
# Binary file I/O (writing and reading .msgpack files)
# Babbel FormatEngine integration and trait usage