Trait RouterExt
pub trait RouterExt<State, L, O, E>: Sealed {
// Required methods
fn with_grpc_service<S>(self, service: S) -> Self
where S: Service<Request> + NamedService,
L: Layer<S> + Layer<UnsupportedGrpcContentType>,
<L as Layer<S>>::Service: Service<Request, Output = O, Error = E>,
<L as Layer<UnsupportedGrpcContentType>>::Service: Service<Request, Output = O, Error = E>;
fn set_grpc_service<S>(&mut self, service: S) -> &mut Self
where S: Service<Request> + NamedService,
L: Layer<S> + Layer<UnsupportedGrpcContentType>,
<L as Layer<S>>::Service: Service<Request, Output = O, Error = E>,
<L as Layer<UnsupportedGrpcContentType>>::Service: Service<Request, Output = O, Error = E>;
}grpc and http and std only.Expand description
Sealed extension methods for registering generated gRPC services on a web Router.
Import this trait to make RouterExt::with_grpc_service and
RouterExt::set_grpc_service available on Router. The route is derived from
NamedService::NAME and preserves the canonical gRPC request URI:
/<package>.<Service>/<Method>.
Required Methods§
fn with_grpc_service<S>(self, service: S) -> Self
fn with_grpc_service<S>(self, service: S) -> Self
Register a generated gRPC service and return the updated router.
Native gRPC requests use HTTP/2, Content-Type: application/grpc (with
an optional structured suffix and parameters), and
POST /<service-name>/<method>. Unlike mounting a nested service, this
route does not strip the service name from the URI before forwarding
the request.
fn set_grpc_service<S>(&mut self, service: S) -> &mut Self
fn set_grpc_service<S>(&mut self, service: S) -> &mut Self
Register a generated gRPC service on this router.
Native gRPC requests use HTTP/2, Content-Type: application/grpc (with
an optional structured suffix and parameters), and
POST /<service-name>/<method>. Unlike mounting a nested service, this
route does not strip the service name from the URI before forwarding
the request.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".