Struct Frame¶
Struct Frame converts Protocol Buffer (.proto) files into serialization code for multiple languages. It generates C, C++, TypeScript, Python, JavaScript, C#, and GraphQL code from a single source.
Why Struct Frame¶
Struct Frame offers several advantages over other serialization systems:
- Zero-copy encoding/decoding in C/C++: Uses packed structs that map directly to memory. No encoding or decoding step required.
- Flexible framing: Multiple frame profiles for different scenarios, from zero-overhead trusted links to robust multi-node networks.
- Nested messages and variable-length arrays: Unlike Mavlink, supports complex message structures with nested messages and variable-length packing for arrays.
- Smaller and simpler than Protobuf/Cap'n Proto: Lower encoding cost and complexity. No schema evolution overhead.
- Cross-platform: Generate code for embedded C, server Python, and frontend TypeScript from a single proto definition.
Installation¶
Install via pip:
The package name is struct-frame, but the Python module uses struct_frame:
Quick Start¶
- Create a
.protofile:
- Generate code:
# Python
python -m struct_frame status.proto --build_py --py_path generated/
# C
python -m struct_frame status.proto --build_c --c_path generated/
# Multiple languages
python -m struct_frame status.proto --build_c --build_py --build_ts
- Use the generated code in your application.
Quick Language Reference¶
For detailed examples, see Language Examples.
Next Steps¶
- Quick Start - Complete walkthrough with C++ example
- Define Messages - Learn proto file syntax
- Language Examples - See detailed examples for each language
- Framing Guide - Understand message framing for reliable communication
Documentation Structure¶
Getting Started¶
Installation and quick start guide.
Basic Usage¶
Essential information for common use cases.
Extended Features¶
Detailed information on framing, SDKs, and advanced features.
Reference¶
Build integration, testing, and development guides.