pub struct RpcMiddleware { /* private fields */ }
Expand description
Middleware for RPC calls
Implementations§
Source§impl RpcMiddleware
impl RpcMiddleware
Sourcepub fn new(metrics: RpcMetrics, transport_label: &str) -> Self
pub fn new(metrics: RpcMetrics, transport_label: &str) -> Self
Create an instance of middleware.
metrics
: Will be used to report statistics.transport_label
: The label that is used when reporting the statistics.
Trait Implementations§
Source§impl<M: Metadata> Middleware<M> for RpcMiddleware
impl<M: Metadata> Middleware<M> for RpcMiddleware
Source§type Future = Box<dyn Future<Error = (), Item = Option<Response>> + Send>
type Future = Box<dyn Future<Error = (), Item = Option<Response>> + Send>
A returned request future.
Source§type CallFuture = Box<dyn Future<Error = (), Item = Option<Output>> + Send>
type CallFuture = Box<dyn Future<Error = (), Item = Option<Output>> + Send>
A returned call future.
Source§fn on_request<F, X>(
&self,
request: Request,
meta: M,
next: F,
) -> Either<FutureResponse, X>
fn on_request<F, X>( &self, request: Request, meta: M, next: F, ) -> Either<FutureResponse, X>
Method invoked on each request.
Allows you to either respond directly (without executing RPC call)
or do any additional work before and/or after processing the request.
Auto Trait Implementations§
impl Freeze for RpcMiddleware
impl !RefUnwindSafe for RpcMiddleware
impl Send for RpcMiddleware
impl Sync for RpcMiddleware
impl Unpin for RpcMiddleware
impl !UnwindSafe for RpcMiddleware
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> 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> 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>
Converts
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>
Converts
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