pub trait Middleware<M: Metadata>:
Send
+ Sync
+ 'static {
type Future: Future<Item = Option<Response>, Error = ()> + Send + 'static;
// Required method
fn on_request<F, X>(
&self,
request: Request,
meta: M,
next: F,
) -> Self::Future
where F: FnOnce(Request, M) -> X + Send,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static;
}
Expand description
RPC middleware
Required Associated Types§
Required Methods§
Sourcefn on_request<F, X>(&self, request: Request, meta: M, next: F) -> Self::Future
fn on_request<F, X>(&self, request: Request, meta: M, next: F) -> Self::Future
Msod 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.