protoc-gen-rust-temporal
A protoc plugin that reads
cludden/protoc-gen-go-temporal
annotations (temporal.v1.*) from a proto service definition and emits a
typed Rust Temporal client.
Status: Phase 0 / bootstrap. The repo carries the scaffolding, vendored annotation schema, and wire-format spec. Code-emission is wired in later phases — see
SPEC.mdfor the delivery plan.
What it does
Given a service annotated for the Go plugin —
service JobService {
rpc RunJob(JobInput) returns (JobOutput) {
option (temporal.v1.workflow) = {
task_queue: "jobs"
id: "{{ .name }}"
};
}
}
— protoc-gen-rust-temporal generates a JobServiceClient exposing a typed
run_job method returning a RunJobHandle, plus signal/query/update methods
mirroring the proto. The intended sibling is
protoc-gen-ts-temporal,
so one annotated proto produces Go, TS, and Rust clients with zero proto
changes.
Quickstart
Install from crates.io:
Then point buf.gen.yaml at the local binary:
# buf.gen.yaml
version: v2
plugins:
- local: protoc-gen-rust-temporal
out: src/gen
The BSR remote-plugin form (remote: buf.build/nu-sync/rust-temporal)
will land once the curated-plugin PR is merged
into bufbuild/plugins.
# buf.gen.yaml
plugins:
- local: protoc-gen-rust-temporal
out: src/gen
Add the runtime helper to your crate's Cargo.toml:
[]
= "0.0"
Wire format
Generated clients speak binary/protobuf end-to-end. See
WIRE-FORMAT.md for the contract; the sibling TS plugin
keeps a byte-identical mirror.
Runtime API
Generated code calls into a consumer-supplied crate::temporal_runtime
module. Every function the plugin emits a call to, when it gets emitted,
and the exact signature it expects are documented in
docs/RUNTIME-API.md. The
examples/job-queue-integration/
crate is a workspace member that exercises every emit branch and
compiles end-to-end against a stubbed facade — use it as the starting
template.
Layout
| Crate / file | Role |
|---|---|
crates/protoc-gen-rust-temporal/ |
The plugin binary + library. |
crates/temporal-proto-runtime/ |
TypedProtoMessage<T> runtime helper used by generated code. |
proto/temporal/v1/temporal.proto |
Vendored copy of cludden's annotation schema. |
SPEC.md |
Design spec + phased delivery plan. |
WIRE-FORMAT.md |
Pinned wire-format contract. |
docs/sdk-shape.md |
Pinned reference for temporalio-sdk 0.4 quirks. |
License
MIT. See LICENSE.