buffa
A pure-Rust Protocol Buffers implementation with first-class protobuf editions support.
Repository Health
Technical Analysis
buffa is a pure-Rust implementation of Protocol Buffers built from the ground up around protobuf editions, treating proto2 and proto3 as feature presets within the editions model rather than separate code paths. It passes the full protobuf conformance suite across binary, JSON, and text encodings with zero expected failures.
buffa generates both owned and zero-copy borrowed types for every message, caches encoded sizes for linear-time serialization, preserves unknown fields for proxy and middleware use cases, and offers runtime reflection for schema-driven encoding without generated code. Its core runtime is no_std + alloc compatible, including JSON serialization via serde, making it suitable for embedded and constrained environments as well as servers.
What You Get
- Editions-first parsing where proto2 and proto3 are feature presets of one code path
- Two-tier owned and zero-copy view types generated for every message
- Binary, proto3 JSON, and text (textproto) wire-format support
- Runtime reflection via DescriptorPool and DynamicMessage without generated code
- A
no_std+alloccore runtime, including serde-based JSON serialization
Common Use Cases
- Encoding and decoding protobuf messages in Rust services and clients
- Building proxies and middleware that need unknown-field round-trip fidelity
- Schema-driven encode/decode and gRPC server reflection without codegen
- Running protobuf serialization in embedded or
no_stdenvironments
Under The Hood
Architecture - The buffa/src/ runtime is organized by protobuf concept: message.rs, view.rs, and message_field.rs implement the two-tier owned/borrowed message model; encoding.rs, encode_sink.rs, and size_cache.rs handle binary serialization with cached sizes for linear-time encoding; json.rs plus the json_helpers/ module and text/ provide the JSON and textproto formats; and editions.rs centralizes the feature-preset resolution that unifies proto2 and proto3. Type-system pieces (enumeration.rs, oneof.rs, map_codec.rs, extension.rs, unknown_fields.rs) and registries (type_registry.rs, any_registry.rs, extension_registry.rs) round out the core, while reflection lives in the sibling buffa-descriptor crate and code generation in buffa-codegen and protoc-gen-buffa.
Tech Stack - Written in pure Rust as a Cargo workspace, buffa is no_std + alloc compatible with optional std and serde features, pins its toolchain via rust-toolchain.toml, and declares an MSRV verified in CI. The workspace includes benchmarks, a conformance harness, fuzzing, and stress tests.
Code Quality - Quality signals are strong: buffa passes the full protobuf conformance suite (binary, JSON, and text) with zero expected failures, maintains dedicated conformance/, fuzz/, stress/, and buffa-test crates, and documents its design in DESIGN.md. Development is very active across a growing contributor base, though the 0.x version line means the API is still stabilizing.
API Design - The generated API is deliberately ergonomic: MessageField<T> derefs to a default instead of forcing Option<Box<T>> unwrapping, EnumValue<T> gives real Rust enums that preserve unknown values, and OwnedView<V> bridges zero-copy views across async boundaries. A long-form guide in docs/guide.md, runnable examples/, and docs.rs reference material support onboarding, but the breadth of editions, reflection, and no_std nuances gives it a meaningful learning curve.