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 orderE.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.