Struct tonic::server::Grpc[][src]

pub struct Grpc<T> { /* fields omitted */ }
Expand description

A gRPC Server handler.

This will wrap some inner Codec and provide utilities to handle inbound unary, client side streaming, server side streaming, and bi-directional streaming.

Each request handler method accepts some service that implements the corresponding service trait and a http request that contains some body that implements some Body.

Implementations

Creates a new gRPC server with the provided Codec.

This is supported on crate feature compression only.

Enable accepting gzip compressed requests.

If a request with an unsupported encoding is received the server will respond with Code::UnUnimplemented.

Example

The most common way of using this is through a server generated by tonic-build:


#[tonic::async_trait]
impl Example for Svc {
    // ...
}

let service = ExampleServer::new(Svc).accept_gzip();
This is supported on crate feature compression only.

Enable sending gzip compressed responses.

Requires the client to also support receiving compressed responses.

Example

The most common way of using this is through a server generated by tonic-build:


#[tonic::async_trait]
impl Example for Svc {
    // ...
}

let service = ExampleServer::new(Svc).send_gzip();

Handle a single unary gRPC request.

Handle a server side streaming request.

Handle a client side streaming gRPC request.

Handle a bi-directional streaming gRPC request.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more