Skip to main content

Crate babbel_msgpack

Crate babbel_msgpack 

Source
Expand description

§Babbel MessagePack

Fast, binary-safe, zero-copy MessagePack parser, serializer, and DOM engine in pure Rust. Adheres strictly to the official MessagePack specification and Babbel’s SOLID architecture.

MessagePack maps with 100% fidelity to Babbel’s universal Value AST:

  • Nil -> Value::Null
  • Boolean -> Value::Bool
  • Signed & Unsigned integers -> Value::Integer(i128)
  • 32-bit & 64-bit IEEE floats -> Value::Float(f64)
  • UTF-8 Strings -> Value::String(String)
  • Binary byte buffers (bin 8/16/32) -> Value::Bytes(Vec<u8>)
  • Arrays -> Value::Array(Vec<Value>)
  • Maps -> Value::Object(Vec<(String, Value)>)

§Quickstart

use babbel_msgpack::{from_bytes, to_vec, MsgPackEngine};
use babbel_core::Value;

let original = Value::Object(vec![
    ("compact".into(), Value::Bool(true)),
    ("schema".into(), Value::Integer(0)),
]);

let encoded = to_vec(&original).unwrap();
let decoded = from_bytes(&encoded).unwrap();
assert_eq!(original, decoded);

Re-exports§

pub use engine::MsgPackEngine;
pub use error::MsgPackError;
pub use parser::Decoder;
pub use parser::DecoderConfig;
pub use parser::from_bytes;
pub use pull::MsgPackPullEvent;
pub use pull::MsgPackPullParser;
pub use serializer::MsgPackTimestamp;
pub use serializer::decode_timestamp;
pub use serializer::encode_timestamp;
pub use serializer::serialize_to_dest;
pub use serializer::to_vec;
pub use constants::*;

Modules§

constants
MessagePack binary format markers and constants.
engine
MessagePack Format Engine adhering to OCP and DIP.
error
Error types for MessagePack encoding and decoding.
parser
High-performance, streaming-capable MessagePack decoder into universal Value AST.
pull
Streaming pull parser for MessagePack payloads operating in O(1) memory.
serializer
High-performance MessagePack serializer for universal Value AST.

Enums§

Value
Universal hierarchical data value across XML, JSON, YAML, and Bencode representations.

Functions§

from_slice
Convenience alias parsing MessagePack from a byte slice into Value.