Skip to content

feat: add MessagePack reader/writer#56

Merged
alvinreal merged 1 commit intomainfrom
fix/issue-27
Feb 22, 2026
Merged

feat: add MessagePack reader/writer#56
alvinreal merged 1 commit intomainfrom
fix/issue-27

Conversation

@alvinreal
Copy link
Owner

Implements MessagePack binary format support using rmpv.

Changes

  • Parser (from_bytes, from_reader): decode MessagePack binary data into Universal Value; from_str accepts hex-encoded strings for CLI pipeline compatibility
  • Writer (to_bytes): encode Universal Value to MessagePack binary; to_string produces hex-encoded output for text-based CLI pipeline
  • All primitive types round-trip correctly: null, bool, int (i64), float (f64), string, bytes
  • Nested structures (maps, arrays) fully preserved with key insertion order
  • Binary data (Value::Bytes) natively preserved as MessagePack binary type
  • Extension types decoded into maps with _ext_type / _ext_data metadata
  • Cross-format round-trip: MessagePack → JSON → MessagePack verified
  • CLI integration: -f msgpack / -t msgpack, auto-detect from .msgpack and .mp extensions
  • 30+ unit tests: primitives, nested structures, empty containers, error handling, hex encoding

Fixes #27

Implements MessagePack binary format support using rmpv:
- Parser: from_bytes/from_reader for binary input, from_str for hex
- Writer: to_bytes for binary output, to_string as hex for CLI pipeline
- All primitive types round-trip: null, bool, int, float, string, bytes
- Nested structures (maps, arrays) fully preserved with key order
- Binary data (Bytes variant) natively preserved
- Cross-format round-trip: MessagePack → JSON → MessagePack
- CLI integration: -f msgpack/-t msgpack, .msgpack/.mp extensions
- 30+ tests covering round-trips, edge cases, errors, hex encoding

Fixes #27
@alvinreal alvinreal merged commit 3663e0d into main Feb 22, 2026
6 checks passed
@alvinreal alvinreal deleted the fix/issue-27 branch February 22, 2026 08:39
@github-actions github-actions bot mentioned this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MessagePack reader/writer

1 participant