Struct sc_rpc_server::RpcMiddleware
source · [−]pub struct RpcMiddleware { /* private fields */ }
Expand description
Middleware for RPC calls
Implementations
sourceimpl 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
sourceimpl<M: Metadata> Middleware<M> for RpcMiddleware
impl<M: Metadata> Middleware<M> for RpcMiddleware
type Future = FutureResponse
type Future = FutureResponse
A returned request future.
type CallFuture = FutureOutput
type CallFuture = FutureOutput
A returned call future.
sourcefn on_request<F, X>(
&self,
request: Request,
meta: M,
next: F
) -> Either<FutureResponse, X> where
F: Fn(Request, M) -> X + Send + Sync,
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
fn on_request<F, X>(
&self,
request: Request,
meta: M,
next: F
) -> Either<FutureResponse, 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. Read more
Auto Trait Implementations
impl !RefUnwindSafe for RpcMiddleware
impl Send for RpcMiddleware
impl Sync for RpcMiddleware
impl Unpin for RpcMiddleware
impl !UnwindSafe for RpcMiddleware
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more