trillium-grpc 0.2.0

gRPC server and client for trillium, built on trillium-http's h2/h2c/h3 support
Documentation

trillium-grpc — gRPC for Trillium

ci crates.io version docs.rs codecov

A spec-conformant gRPC server and client for trillium, built as a thin layer on trillium-http's HTTP/2 / h2c / HTTP/3 support. Supports all four call shapes (unary, server-streaming, client-streaming, bidirectional), protobuf and optional JSON codecs, and per-message compression.

You write a .proto; codegen produces the prost message types, a service trait you implement, a server handler that mounts into a trillium handler chain, and a typed client. There are three ways to run codegen — the trillium grpc CLI (output committed to your tree), the generate! macro, or a build script — all producing the same service code.

impl Greeter for MyGreeter {
    async fn say_hello(
        &self,
        _conn: &mut GrpcServerConn,
        request: HelloRequest,
    ) -> Result<HelloReply, Status> {
        Ok(HelloReply { message: format!("Hello, {}", request.name) })
    }
}

trillium_tokio::run(GreeterServer::new(MyGreeter));

See the API documentation for the full guide, and examples/greeter.rs for a complete, runnable server and client covering all four shapes (cargo run --example greeter --features macros).

License