Trait jsonrpc_core::Middleware
[−]
[src]
pub trait Middleware<M: Metadata>: Send + Sync + 'static { type Future: Future<Item = Option<Response>, Error = ()> + Send + 'static; 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; }
RPC middleware
Associated Types
Required Methods
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,
F: FnOnce(Request, M) -> X + Send,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
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.