pub struct GrpcWebLayer;Expand description
Translates gRPC-web requests to gRPC for the layers after it — put it in
front of a GrpcProxy:
use rust_web_server::app::App;
use rust_web_server::core::New;
use rust_web_server::proxy::{GrpcProxy, GrpcWebLayer};
let app = App::new()
.wrap(GrpcWebLayer::new())
.wrap(GrpcProxy::new(["grpc-service:50051"]));Implementations§
Source§impl GrpcWebLayer
impl GrpcWebLayer
Trait Implementations§
Source§impl Default for GrpcWebLayer
impl Default for GrpcWebLayer
Source§impl Middleware for GrpcWebLayer
impl Middleware for GrpcWebLayer
Source§fn accepts_streamed_body(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn accepts_streamed_body( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
The body passes through (decoded on the fly for -text).
fn handle( &self, request: &Request, connection: &ConnectionInfo, next: &dyn Application, ) -> Result<Response, String>
Source§fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
true when this layer’s own work for request never blocks (in-memory
state, atomics, short mutexes) — see Application::runs_inline. A
WithMiddleware stack runs inline only if every layer and the inner
application agree. Default false.Source§fn is_passthrough(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn is_passthrough( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
true when handle would do nothing for request but call next
(e.g. a rate limit that isn’t configured). A WithMiddleware stack
offers the inner application’s execute_async only if every layer
passes the request through. Default false.Source§fn answers_streamed_body(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn answers_streamed_body( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
true when this layer answers request itself — it doesn’t call
next — and reads its body as a stream (a proxy forwarding it as it
arrives). The body is then streamed whatever the layers after it and
the application would say. Requires accepts_streamed_body. Since
18.3.0.Auto Trait Implementations§
impl Freeze for GrpcWebLayer
impl RefUnwindSafe for GrpcWebLayer
impl Send for GrpcWebLayer
impl Sync for GrpcWebLayer
impl Unpin for GrpcWebLayer
impl UnsafeUnpin for GrpcWebLayer
impl UnwindSafe for GrpcWebLayer
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