Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@arjan-bal
Copy link
Collaborator

This change adds server code generation using Protobuf Rust. To test the generated code, a Go client and a Tonic client using Prost are used to run interop tests against the Tonic server implemented with Protobuf Rust.

Note: The generated code uses generate_default_stubs = true, consistent with other gRPC implementations. This avoids breaking builds when a new method is added to the .proto file. In practice, this means that the server trait does not include associated types for response streams.

@arjan-bal arjan-bal force-pushed the grpc-codegen-server branch from 53919c3 to f99dd76 Compare July 30, 2025 17:46
@arjan-bal arjan-bal force-pushed the grpc-codegen-server branch from f99dd76 to 2bac02c Compare July 30, 2025 17:57
@arjan-bal arjan-bal force-pushed the grpc-codegen-server branch from 14e9aba to 422f9dd Compare July 30, 2025 18:20
@arjan-bal arjan-bal requested review from LucioFranco and dfawley July 30, 2025 18:47
@arjan-bal arjan-bal removed their assignment Aug 18, 2025
Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I just have a few comments left inline.

# Avoid unbound variable errors on MacOS with bash version < 4.4.
# See: https://stackoverflow.com/a/61551944
flags+=( ${TLS_ARRAY[@]+"${TLS_ARRAY[@]}"} )
interop/bin/client_"${OS}"_amd64"${EXT}" "${flags[@]}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also make it so we can mix and match codecs here with the client?

R"rs(
$trait_doc$
#[async_trait]
pub trait $server_trait$ : std::marker::Send + std::marker::Sync + 'static {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub trait $server_trait$ : std::marker::Send + std::marker::Sync + 'static {
pub trait $server_trait$: std::marker::Send + std::marker::Sync + 'static {

Is this space needed? When we use quote we need this for its interpolation but I don't think the c++ stuff needs that?

static void GenerateMethods(Printer &printer, const Service &service,
const GrpcOpts &opts) {
static const std::string unary_format = R"rs(
#[allow(non_camel_case_types)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have this with the other codegen, why do we need this here?

@LucioFranco LucioFranco merged commit 8ce9ae6 into hyperium:master Aug 22, 2025
20 checks passed
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.

3 participants