Skip to main content

Module dispatch

Module dispatch 

Source
Available on crate feature server only.
Expand description

Server-side request dispatch.

The Server trait’s methods are what generated code calls per RPC, resolved through a blanket impl so Prost::unary(conn, ...) works without a turbofish. The three half-duplex shapes (unary, client-streaming, server-streaming) run entirely in Handler::run: they take the Conn, drive the codec/framing around your method, and return a normal trillium response whose body carries grpc-status in HTTP trailers — no Upgrade. Bidi is the one shape that upgrades, because read-while-write requires the response head already flushed.

prepare_grpc_conn is the shared preflight (content-type / te: trailers validation, response content-type / grpc-accept-encoding), called from generated Handler::run after path matching.

Traits§

Server
Server-side dispatch methods, available on any codec type via a blanket impl. Generated code calls these as Prost::unary(conn, ...) etc.

Functions§

prepare_grpc_conn
Validate request preflight (content-type, te:trailers) and set the gRPC response headers (content-type, grpc-accept-encoding). Returns the conn with those headers set, or an error-shaped conn if preflight failed.