Struct Grpc
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§
§impl<T> Grpc<T>where
T: Codec,
impl<T> Grpc<T>where
T: Codec,
pub fn with_accept_compressed(self, encoding: CompressionEncoding) -> Grpc<T>
pub fn with_accept_compressed(self, encoding: CompressionEncoding) -> Grpc<T>
Enable accepting compressed requests.
If a request with an unsupported encoding is received the server will respond with
Code::UnUnimplemented.
pub fn set_accept_compressed(
&mut self,
encoding: CompressionEncoding,
) -> &mut Grpc<T>
pub fn set_accept_compressed( &mut self, encoding: CompressionEncoding, ) -> &mut Grpc<T>
Enable accepting compressed requests.
If a request with an unsupported encoding is received the server will respond with
Code::UnUnimplemented.
pub fn with_send_compressed(self, encoding: CompressionEncoding) -> Grpc<T>
pub fn with_send_compressed(self, encoding: CompressionEncoding) -> Grpc<T>
Enable sending compressed responses.
Requires the client to also support receiving compressed responses.
pub fn set_send_compressed(
&mut self,
encoding: CompressionEncoding,
) -> &mut Grpc<T>
pub fn set_send_compressed( &mut self, encoding: CompressionEncoding, ) -> &mut Grpc<T>
Enable sending compressed responses.
Requires the client to also support receiving compressed responses.
pub fn with_max_decoding_message_size(self, limit: usize) -> Grpc<T>
pub fn with_max_decoding_message_size(self, limit: usize) -> Grpc<T>
Limits the maximum size of a decoded message.
pub fn set_max_decoding_message_size(&mut self, limit: usize) -> &mut Grpc<T>
pub fn set_max_decoding_message_size(&mut self, limit: usize) -> &mut Grpc<T>
Limits the maximum size of a decoded message.
pub fn with_max_encoding_message_size(self, limit: usize) -> Grpc<T>
pub fn with_max_encoding_message_size(self, limit: usize) -> Grpc<T>
Limits the maximum size of a encoded message.
pub fn set_max_encoding_message_size(&mut self, limit: usize) -> &mut Grpc<T>
pub fn set_max_encoding_message_size(&mut self, limit: usize) -> &mut Grpc<T>
Limits the maximum size of a encoded message.
pub fn with_compression_config( self, accept_encodings: EnabledCompressionEncodings, send_encodings: EnabledCompressionEncodings, ) -> Grpc<T>
pub fn set_compression_config( &mut self, accept_encodings: EnabledCompressionEncodings, send_encodings: EnabledCompressionEncodings, ) -> &mut Grpc<T>
pub fn with_max_message_size_config( self, max_decoding_message_size: Option<usize>, max_encoding_message_size: Option<usize>, ) -> Grpc<T>
pub fn set_max_message_size_config( &mut self, max_decoding_message_size: Option<usize>, max_encoding_message_size: Option<usize>, ) -> &mut Grpc<T>
pub async fn unary<S, B>(
&mut self,
service: S,
req: Request<B>,
) -> Result<Response, Box<dyn Error + Sync + Send>>
pub async fn unary<S, B>( &mut self, service: S, req: Request<B>, ) -> Result<Response, Box<dyn Error + Sync + Send>>
Handle a single unary gRPC request.
pub async fn server_streaming<S, B>(
&mut self,
service: S,
req: Request<B>,
) -> Result<Response, Box<dyn Error + Sync + Send>>
pub async fn server_streaming<S, B>( &mut self, service: S, req: Request<B>, ) -> Result<Response, Box<dyn Error + Sync + Send>>
Handle a server side streaming request.
pub async fn client_streaming<S, B>(
&mut self,
service: S,
req: Request<B>,
) -> Result<Response, Box<dyn Error + Sync + Send>>
pub async fn client_streaming<S, B>( &mut self, service: S, req: Request<B>, ) -> Result<Response, Box<dyn Error + Sync + Send>>
Handle a client side streaming gRPC request.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Grpc<T>where
T: Freeze,
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more