Skip to content

Commit b60cff4

Browse files
committed
Add anthropics/connect-rust plugin v0.3.2
connect-rust is a Tower-based Rust implementation of the ConnectRPC protocol. The plugin emits service stubs (server traits, typed clients, monomorphic dispatchers) for the Connect, gRPC, and gRPC-Web protocols from a single service implementation. Passes the full ConnectRPC conformance suite. Generated stubs reference message types via absolute Rust paths into the buffa SDK crate (declared as a plugin dep). The plugin accepts `extern_path=.=<rust_path>` (or shorthand `buffa_module=<rust_path>`) to point at the buffa SDK location, same format as tonic/prost. Crates: https://crates.io/crates/connectrpc-codegen Repo: https://github.com/anthropics/connect-rust
1 parent b429f98 commit b60cff4

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source:
2+
crates:
3+
crate_name: connectrpc-codegen
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!Dockerfile
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# syntax=docker/dockerfile:1.19
2+
FROM rust:1.91.1-alpine3.22 AS builder
3+
RUN apk add --no-cache musl-dev
4+
WORKDIR /app
5+
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6+
# The protoc-gen-connect-rust binary is a [[bin]] target in the
7+
# connectrpc-codegen crate. cargo install compiles it by crate name.
8+
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \
9+
cargo install connectrpc-codegen --version 0.3.2 --locked --root /app
10+
11+
FROM gcr.io/distroless/static-debian12:latest@sha256:87bce11be0af225e4ca761c40babb06d6d559f5767fbf7dc3c47f0f1a466b92c AS base
12+
13+
FROM scratch
14+
COPY --link --from=base / /
15+
COPY --link --from=builder /app/bin/protoc-gen-connect-rust /protoc-gen-connect-rust
16+
USER nobody
17+
ENTRYPOINT ["/protoc-gen-connect-rust"]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: v1
2+
name: buf.build/anthropics/connect-rust
3+
plugin_version: v0.3.2
4+
source_url: https://github.com/anthropics/connect-rust
5+
description: Generates ConnectRPC service traits, typed clients, and monomorphic dispatchers for Rust. Compatible with the Connect, gRPC, and gRPC-Web protocols. Passes the full ConnectRPC conformance suite.
6+
deps:
7+
- plugin: buf.build/anthropics/buffa:v0.3.0
8+
output_languages:
9+
- rust
10+
spdx_license_id: Apache-2.0
11+
license_url: https://github.com/anthropics/connect-rust/blob/v0.3.2/LICENSE
12+
registry:
13+
cargo:
14+
rust_version: "1.88"
15+
deps:
16+
# ConnectRPC runtime: Router, Context, ConnectError, client transports.
17+
# https://github.com/anthropics/connect-rust/blob/v0.3.2/connectrpc/Cargo.toml
18+
- name: "connectrpc"
19+
req: "0.3.2"
20+
default_features: true
21+
# Generated service stubs use buffa::Message, buffa::view::OwnedView,
22+
# buffa::bytes::Bytes directly. Message types live in the buffa SDK
23+
# crate (via the plugin dep above); this dep is for the runtime API.
24+
- name: "buffa"
25+
req: "0.3.0"
26+
default_features: true
27+
# Streaming method signatures use futures::Stream.
28+
- name: "futures"
29+
req: "0.3"
30+
default_features: true
31+
# Client transport bounds reference http_body::Body.
32+
- name: "http-body"
33+
req: "1"
34+
default_features: true
35+
# The plugin accepts `extern_path=.=<rust_path>` (or the shorthand
36+
# `buffa_module=<rust_path>`) to tell it where the buffa-generated message
37+
# types live. BSR should inject this based on the buffa dep's SDK crate
38+
# name, same as tonic receives extern_path for its prost dep. Leaving
39+
# opts empty here; please advise if an explicit entry is needed.
40+
opts: []

0 commit comments

Comments
 (0)