Low-level examples demonstrating qres_core usage in Rust.
Minimal no_std compatible compression example.
Features:
qres_coreusage withoutstd- Q16.16 fixed-point arithmetic
- Deterministic compression
- Suitable for embedded targets (ESP32-C6, STM32, etc.)
Run:
cd examples/rust/01_basic_compression
cargo run --releaseExpected Output:
QRES Basic Compression (no_std)
================================
Original: 48 bytes
Compressed: 12 bytes
Ratio: 4.00x
✓ Decompression verified
Implement custom Predictor trait for domain-specific compression.
Features:
- Custom predictor implementation
- Linear regression example
- Integration with
qres_core::compress - Training and serialization
Run:
cd examples/rust/02_custom_predictor
cargo run --release- Rust 1.75+ (rustup.rs)
- For embedded targets:
rustup target add thumbv7em-none-eabihf # ARM Cortex-M4/M7 rustup target add riscv32imc-unknown-none-elf # RISC-V
cd 01_basic_compression
cargo build --release --target riscv32imc-unknown-none-elf --no-default-featurescargo build --release --target thumbv7em-none-eabihf --no-default-featuresFull Rust API: docs/reference/API_REFERENCE.md
Core traits:
qres_core::Predictor- Custom compression modelsqres_core::Aggregator- Byzantine-tolerant consensusqres_core::ModelPersistence- State serialization
Benchmarks on x86_64 (i7-10700K, release build):
| Operation | Time | Throughput |
|---|---|---|
compress() |
100ns | 10M ops/sec |
decompress() |
80ns | 12M ops/sec |
Predictor::forward() |
50ns | 20M ops/sec |
Memory: <1 KB per-node overhead (fixed-size buffers, no heap)
Use cross for easy cross-compilation:
cargo install cross
cross build --release --target aarch64-unknown-linux-gnuSupported targets:
x86_64-unknown-linux-gnuaarch64-unknown-linux-gnu(ARM64/Raspberry Pi 4)armv7-unknown-linux-gnueabihf(ARM32/Raspberry Pi 3)wasm32-unknown-unknown(WebAssembly)riscv32imc-unknown-none-elf(ESP32-C6)thumbv7em-none-eabihf(STM32)
Enable debug logging:
RUST_LOG=debug cargo run --releaseUse gdb for embedded debugging:
cargo embed --release --chip STM32F407VGTxRun unit tests:
cargo test --releaseRun benchmarks:
cargo bench- Python API: See examples/python/ for high-level usage
- Full Demo: See examples/virtual_iot_network/ for 100-node mesh
- Hardware: See docs/deployment/ for ESP32-C6/Pi deployment guides
Dual-licensed under MIT or Apache-2.0.