buffa 0.3.0

A pure Rust Protocol Buffers implementation with first-class editions support
Documentation

buffa

crates.io docs.rs

The runtime crate for buffa — a pure-Rust Protocol Buffers implementation with first-class editions support, zero-copy views, and no_std compatibility.

This crate contains the Message trait, wire-format encode/decode primitives, MessageField / EnumValue / UnknownFields container types, and the zero-copy view layer. Generated code emitted by buffa-build or protoc-gen-buffa depends on this crate.

Quick start

See the workspace README for end-to-end setup with buf generate or build.rs. In short:

use buffa::Message;

let bytes = person.encode_to_vec();
let decoded = Person::decode_from_slice(&bytes)?;

For untrusted input, tighten limits with DecodeOptions:

use buffa::DecodeOptions;

let msg: Person = DecodeOptions::new()
    .with_recursion_limit(50)
    .with_max_message_size(1024 * 1024)  // 1 MiB
    .decode_from_slice(&bytes)?;

Feature flags

Flag Default Enables
std std::io::Read decoders, HashMap for map fields, thread-local JSON parse options
json Proto3 JSON via serde
arbitrary arbitrary::Arbitrary impls for fuzzing

With default-features = false the crate is #![no_std] (requires alloc).

Documentation

Conformance

buffa passes the full protobuf conformance suite for binary and JSON encoding (both std and no_std builds). Text format (textproto) is not supported.

License

Apache-2.0