1 unstable release

Uses new Rust 2021

0.1.0 Aug 6, 2022

#224 in Compression

22 downloads per month
Used in minnow

GPL-3.0 license

526 lines


Minnow is a library for serialising objects into extremely compact binary representations using arithmetic coding.

Minnow is a derive macro and convenience layer over the Arithmetic-Coding library.

use minnow::Encodeable;

#[derive(Debug, Encodeable, PartialEq)]
pub struct NavigationReport {
    #[encode(float(min = -10_000.0, max = 10_000.0, precision = 1))]
    pub x: f64,
    #[encode(float(min = -10_000.0, max = 10_000.0, precision = 1))]
    pub y: f64,
    #[encode(float(min = -5_000.0, max = 0.0, precision = 0))]
    pub z: f64,
    pub vehicle_class: Option<VehicleClass>,
    pub battery_ok: Option<bool>,

#[derive(Debug, Encodeable, PartialEq)]
pub enum VehicleClass {

let input = NavigationReport {
    x: 450.0,
    y: 550.0,
    z: -100.0,
    vehicle_class: Some(VehicleClass::Auv),
    battery_ok: Some(true),

let compressed = input.encode_bytes();
let output = NavigationReport::decode_bytes(&compressed);

assert_eq!(input, output);

Minnow was originally conceived as a library for creating compact messages for underwater acoustic communications. It is heavily inspired by Dynamic Compact Control Language (DCCL)


This project is publicly available under the GNU General Public License v3.0. It may optionally be distributed under the permissive MIT license by commercial arrangement.


~26K SLoC