2 releases

Uses new Rust 2024

0.1.1 Feb 27, 2026
0.1.0 Feb 26, 2026

#1786 in Encoding

Download history 12/week @ 2026-03-04 19/week @ 2026-03-11 17/week @ 2026-03-18 8/week @ 2026-03-25 19/week @ 2026-04-01 13/week @ 2026-04-08

58 downloads per month
Used in 11 crates

MPL-2.0 license

125KB
2K SLoC

Binary encoding and decoding for Gaia project.

This crate provides utilities for reading and writing binary data with support for different byte orders and position tracking.


gaia-binary

Binary encoding and decoding for the Gaia project.

Features

  • Generic binary reader and writer with position tracking.
  • Support for fixed-size encoding with specific byte orders (Big Endian, Little Endian).
  • Support for variable-length encoding (LEB128).
  • ZigZag transformation for signed integers.
  • Zero external dependencies (manually implemented byte order logic).

Architecture

The crate is structured around the BinaryFormat trait, which defines how basic types are read and written. Implementations include:

  • Fixed<E>: Fixed-size encoding using byte order E.
  • Leb128<E>: Variable-length encoding.
  • ZigZag<F>: Wraps another format to apply ZigZag encoding to signed integers.

BinaryReader and BinaryWriter wrap any type implementing Read or Write and provide high-level methods for reading and writing data using a chosen BinaryFormat.

Dependencies

~6.5–10MB
~97K SLoC