Skip to content

Add community/anthropics-buffa plugin v0.2.0#2333

Draft
iainmcgin wants to merge 1 commit intobufbuild:mainfrom
iainmcgin:add-buffa-plugin
Draft

Add community/anthropics-buffa plugin v0.2.0#2333
iainmcgin wants to merge 1 commit intobufbuild:mainfrom
iainmcgin:add-buffa-plugin

Conversation

@iainmcgin
Copy link

@iainmcgin iainmcgin commented Mar 17, 2026

Adds the protoc-gen-buffa plugin for Rust protobuf code generation.

About buffa

buffa is a zero-copy Rust Protobuf implementation with:

  • Editions support (2023/2024) and full proto2/proto3 coverage
  • Zero-copy view types - borrowed &str/&[u8] field access without owned allocation
  • no_std + alloc compatible
  • Proto3 JSON mapping with serde integration
  • Conformance: passes the protobuf conformance suite (5539 binary+JSON tests, 0 expected failures)

Crates are on crates.io: buffa, buffa-types, protoc-gen-buffa.

Output convention

The plugin emits one .rs file per proto file with a flat naming scheme: foo/v1/bar.proto -> foo.v1.bar.rs. No subdirectories, no mod.rs - module tree assembly is a separate local-only packaging plugin (protoc-gen-buffa-packaging) that BSR does not need since it synthesizes lib.rs server-side.

Open questions for review

  1. Org placement: I put this under community/anthropics-buffa following the neoeinstein-prost pattern. Happy to move if there is a preferred location.
  2. opts: I set json=true and views=true. If BSR has conventions for which opts to expose vs bake in, please advise.
  3. File naming: The per-file output naming (pkg.subpkg.file.rs) is flat but per-proto-file, not per-package like prost. If BSR's lib.rs synthesis expects per-package naming instead, we can add a plugin option to switch modes.

Process note

CONTRIBUTING.md asks for an issue first - happy to open one if you would prefer to discuss before reviewing the PR. Filed this as a draft in the meantime.

Related: #2334 (connectrpc/rust) declares this plugin as a dep, so this one would need to land first.

buffa is a zero-copy Rust Protobuf implementation with editions support
(2023/2024), no_std compatibility, and view types for borrowed field
access. Passes the protobuf conformance suite (5539 binary+JSON tests).

The plugin emits one .rs file per proto file using a flat naming
convention (`foo/v1/bar.proto` -> `foo.v1.bar.rs`), matching what BSR
expects. Module tree assembly is a separate `protoc-gen-buffa-packaging`
plugin in the same repo, not needed for BSR (which synthesizes lib.rs
server-side).

Crates: https://crates.io/crates/protoc-gen-buffa
Repo: https://github.com/anthropics/buffa
@bufdev
Copy link
Member

bufdev commented Mar 19, 2026

I think we might want to make a top-level anthropics org for this, instead of under community - also re: connect-rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants