pub async fn serve<C, R, PC, PR, S, F, G>(
config: ServeConfig,
client: G,
f: F
) -> Result<(), Error> where
PC: Send + Sync + 'static + Debug,
PR: Send + Sync + 'static + Debug,
C: RustType<PC> + Send + Sync + 'static,
R: RustType<PR> + Send + Sync,
G: GenericClient<C, R>,
S: Service<Request<Body>, Response = Response<BoxBody>, Error = Infallible> + NamedService + Clone + Send + 'static,
S::Future: Send + 'static,
F: FnOnce(GrpcServer<PC, PR>) -> S + Send + 'static,
Expand description
Start a grpc server, and forward commands and responses to the
local client
.
The trait bounds here are intimidating, but the f
parameter is
_a function that turns a GrpcServer<ProtoCommandType, ProtoResponseType>
into a tower::Service
that represents a grpc server. This is always
encapsulated by the ExportedFromTonicServer::new
for a specific protobuf
service
.
Some servers (like ProtoComputeServer
) are re-exported from this module
for convenience.