Trait jsonrpc_core::middleware::Middleware [−][src]
RPC middleware
Associated Types
type Future: Future<Item = Option<Response>, Error = ()> + Send + 'static
[src]
A returned request future.
type CallFuture: Future<Item = Option<Output>, Error = ()> + Send + 'static
[src]
A returned call future.
Provided methods
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: Future<Item = Option<Response>, Error = ()> + Send + 'static,
[src]
&self,
request: Request,
meta: M,
next: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
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.
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: Future<Item = Option<Output>, Error = ()> + Send + 'static,
[src]
&self,
call: Call,
meta: M,
next: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,
Method invoked on each call inside a request.
Allows you to either handle the call directly (without executing RPC call).
Implementations on Foreign Types
impl<M: Metadata, A: Middleware<M>, B: Middleware<M>> Middleware<M> for (A, B)
[src]
type Future = Either<A::Future, B::Future>
type CallFuture = Either<A::CallFuture, B::CallFuture>
fn on_request<F, X>(
&self,
request: Request,
meta: M,
process: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
[src]
&self,
request: Request,
meta: M,
process: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
fn on_call<F, X>(
&self,
call: Call,
meta: M,
process: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,
[src]
&self,
call: Call,
meta: M,
process: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,
impl<M: Metadata, A: Middleware<M>, B: Middleware<M>, C: Middleware<M>> Middleware<M> for (A, B, C)
[src]
type Future = Either<A::Future, Either<B::Future, C::Future>>
type CallFuture = Either<A::CallFuture, Either<B::CallFuture, C::CallFuture>>
fn on_request<F, X>(
&self,
request: Request,
meta: M,
process: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
[src]
&self,
request: Request,
meta: M,
process: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
fn on_call<F, X>(
&self,
call: Call,
meta: M,
process: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,
[src]
&self,
call: Call,
meta: M,
process: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,
impl<M: Metadata, A: Middleware<M>, B: Middleware<M>, C: Middleware<M>, D: Middleware<M>> Middleware<M> for (A, B, C, D)
[src]
type Future = Either<A::Future, Either<B::Future, Either<C::Future, D::Future>>>
type CallFuture = Either<A::CallFuture, Either<B::CallFuture, Either<C::CallFuture, D::CallFuture>>>
fn on_request<F, X>(
&self,
request: Request,
meta: M,
process: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
[src]
&self,
request: Request,
meta: M,
process: F
) -> Either<Self::Future, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
fn on_call<F, X>(
&self,
call: Call,
meta: M,
process: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,
[src]
&self,
call: Call,
meta: M,
process: F
) -> Either<Self::CallFuture, X> where
F: Fn(Call, M) -> X + Send + Sync,
X: Future<Item = Option<Output>, Error = ()> + Send + 'static,