pub struct Grpc<T> { /* private fields */ }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§
source§impl<T> Grpc<T>where
    T: Codec,
 
impl<T> Grpc<T>where T: Codec,
sourcepub async fn unary<S, B>(
    &mut self,
    service: S,
    req: Request<B>
) -> Response<BoxBody>where
    S: UnaryService<T::Decode, Response = T::Encode>,
    B: Body + Send + 'static,
    B::Error: Into<Box<dyn Error + Send + Sync>> + Send,
 
pub async fn unary<S, B>( &mut self, service: S, req: Request<B> ) -> Response<BoxBody>where S: UnaryService<T::Decode, Response = T::Encode>, B: Body + Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>> + Send,
Handle a single unary gRPC request.
sourcepub async fn server_streaming<S, B>(
    &mut self,
    service: S,
    req: Request<B>
) -> Response<BoxBody>where
    S: ServerStreamingService<T::Decode, Response = T::Encode>,
    S::ResponseStream: Send + 'static,
    B: Body + Send + 'static,
    B::Error: Into<Box<dyn Error + Send + Sync>> + Send,
 
pub async fn server_streaming<S, B>( &mut self, service: S, req: Request<B> ) -> Response<BoxBody>where S: ServerStreamingService<T::Decode, Response = T::Encode>, S::ResponseStream: Send + 'static, B: Body + Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>> + Send,
Handle a server side streaming request.
sourcepub async fn client_streaming<S, B>(
    &mut self,
    service: S,
    req: Request<B>
) -> Response<BoxBody>where
    S: ClientStreamingService<T::Decode, Response = T::Encode>,
    B: Body + Send + 'static,
    B::Error: Into<Box<dyn Error + Send + Sync>> + Send + 'static,
 
pub async fn client_streaming<S, B>( &mut self, service: S, req: Request<B> ) -> Response<BoxBody>where S: ClientStreamingService<T::Decode, Response = T::Encode>, B: Body + Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>> + Send + 'static,
Handle a client side streaming gRPC request.
sourcepub async fn streaming<S, B>(
    &mut self,
    service: S,
    req: Request<B>
) -> Response<BoxBody>where
    S: StreamingService<T::Decode, Response = T::Encode> + Send,
    S::ResponseStream: Send + 'static,
    B: Body + Send + 'static,
    B::Error: Into<Box<dyn Error + Send + Sync>> + Send,
 
pub async fn streaming<S, B>( &mut self, service: S, req: Request<B> ) -> Response<BoxBody>where S: StreamingService<T::Decode, Response = T::Encode> + Send, S::ResponseStream: Send + 'static, B: Body + Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>> + Send,
Handle a bi-directional streaming gRPC request.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Grpc<T>where T: RefUnwindSafe,
impl<T> Send for Grpc<T>where T: Send,
impl<T> Sync for Grpc<T>where T: Sync,
impl<T> Unpin for Grpc<T>where T: Unpin,
impl<T> UnwindSafe for Grpc<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
 
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
 
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
 
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
 
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
 
fn into_request(self) -> Request<T>
Wrap the input message 
T in a tonic::Request