Trait oe_rpc_servers::Middleware
source · [−]pub trait Middleware<M>: 'static + Send + Sync where
M: Metadata, {
type Future: 'static + Future + Send;
type CallFuture: 'static + Future + Send;
fn on_request<F, X>(
&self,
request: Request,
meta: M,
next: F
) -> Either<Self::Future, X>
where
F: Fn(Request, M) -> X + Send + Sync,
X: 'static + Future<Item = Option<Response>, Error = ()> + Send,
{ ... }
fn on_call<F, X>(
&self,
call: Call,
meta: M,
next: F
) -> Either<Self::CallFuture, X>
where
F: Fn(Call, M) -> X + Send + Sync,
X: 'static + Future<Item = Option<Output>, Error = ()> + Send,
{ ... }
}
Expand description
RPC middleware
Associated Types
type CallFuture: 'static + Future + Send
type CallFuture: 'static + Future + Send
A returned call future.
Provided methods
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.
Method invoked on each call inside a request.
Allows you to either handle the call directly (without executing RPC call).