Expand description
This module provides utilities for generating tonic service definitions for use by our client
sdk code generators.
[2024-12-30] dkasten: fork of tonic-build/src/manual.rs at https://github.com/hyperium/tonic/commit/1c5150aaf62d6e72ce6c07966a9f19ceedb52702
§Example
ⓘ
fn main() -> Result<(), Box<dyn std::error::Error>> {
let greeter_service = tonic_build::manual::Service::builder()
.name("Greeter")
.package("helloworld")
.method(
tonic_build::manual::Method::builder()
.name("say_hello")
.route_name("SayHello")
// Provide the path to the Request type
.input_type("crate::HelloRequest")
// Provide the path to the Response type
.output_type("super::HelloResponse")
// Provide the path to the Codec to use
.codec_path("crate::JsonCodec")
.build(),
)
.build();
// note we run first with a borrowed reference since tonic takes ownership
sdk_build::manual::Builder::new().compile(&[&greeter_service]);
tonic_build::manual::Builder::new().compile(&[greeter_service]);
Ok(())
}Structs§
- Builder
- Service generator builder.