You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v0.4.0: references to a service in messages, requests, and replies
References to a service. An empty message marked option (protocontract.v1.service) = "pkg.Service"; stands for an
implementation of that service: the plugin emits a type for it
(<module>::<Name>, e.g. clock_ref::ClockRef) that holds the
implementation in the form it was given, and buffa maps the message to it
with an extern_path, so a field, a request, or a reply can carry an
implementation. The receiver takes the form it needs with to_sync, to_async_inline, or to_async_offload. A reference does not survive
encoding: decoded it is RuntimeCode::Unbound when used, and it has no
JSON form. The option is declared in protocontract/v1/options.proto,
shipped in the protocontract crate under proto/.
Plugin parameters json=<true|false> and validate=<true|false>: with
buffa's json=true, reference types get serde impls too; next to protoc-gen-protovalidate-buffa, they implement Validate (always
valid), which it calls on every message field.
RuntimeCode::Unbound and RuntimeCode::NoRuntime.
Every Dyn<Service>Async handle has ptr_eq: whether two handles hold
the same implementation.
examples/refs: a reference in a field, a list, a request, and a reply.
Changed
RuntimeCode has two more variants, so an exhaustive match on it no
longer compiles: add an arm for Unbound and NoRuntime, or a
wildcard.
Build pins: bazel_utils 0.4.0 and Buf CLI v1.74.0. The pins alone do not
change the generated code.
buildifier, markdownlint, buf lint, rustfmt, and cargo-audit now run on
Windows too, and the golden checks of the generated code on Windows
ARM64: the reasons they were off are gone (bazel_utils runs its test
scripts on Windows since 0.3.0, and catalogs every plugin there). Only
the rustdoc tests stay off on Windows, where rules_rust cannot link them; cargo test runs them. The release workflow names each of these tests,
so a platform that cannot run one fails.
Upgrading from 0.3
Take protocontract = "0.4" and the 0.4.0 plugin together.
An exhaustive match on RuntimeCode needs arms for Unbound and NoRuntime, or a wildcard.
Nothing else changes in the generated code of an existing contract but
the new Dyn<Service>Async::ptr_eq.
To use references: import protocontract/v1/options.proto (in the protocontract crate, under proto/), mark an empty message with option (protocontract.v1.service) = "pkg.Service";, and map it to <mount>::<module>::<Name> with the same extern_path in both protoc-gen-buffa and this plugin.