Struct jsonrpsee_http_server::RpcContextModule [−][src]
pub struct RpcContextModule<Context> { /* fields omitted */ }
Expand description
Similar to RpcModule
but wraps an additional context argument that can be used
to access data during call execution.
Implementations
impl<Context> RpcContextModule<Context>
[src]
impl<Context> RpcContextModule<Context>
[src]pub fn new(ctx: Context) -> RpcContextModule<Context>
[src]
pub fn new(ctx: Context) -> RpcContextModule<Context>
[src]Create a new module with a given shared Context
.
pub fn register_method<R, F>(
&mut self,
method_name: &'static str,
callback: F
) -> Result<(), Error> where
F: Fn(RpcParams<'_>, &Context) -> Result<R, CallError> + Send + Sync + 'static,
R: Serialize,
Context: Send + Sync + 'static,
[src]
pub fn register_method<R, F>(
&mut self,
method_name: &'static str,
callback: F
) -> Result<(), Error> where
F: Fn(RpcParams<'_>, &Context) -> Result<R, CallError> + Send + Sync + 'static,
R: Serialize,
Context: Send + Sync + 'static,
[src]Register a new RPC method, which responds with a given callback.
pub fn into_module(self) -> RpcModule
[src]
pub fn into_module(self) -> RpcModule
[src]Convert this RpcContextModule
into a regular RpcModule
that can be registered on the Server
.
pub fn into_methods(
self
) -> HashMap<&'static str, Box<dyn Fn(Id<'_>, RpcParams<'_>, &UnboundedSender<String>, usize) + 'static + Send + Sync, Global>, BuildHasherDefault<FxHasher>>
[src]
pub fn into_methods(
self
) -> HashMap<&'static str, Box<dyn Fn(Id<'_>, RpcParams<'_>, &UnboundedSender<String>, usize) + 'static + Send + Sync, Global>, BuildHasherDefault<FxHasher>>
[src]Convert a module into methods. Consumes self.
Methods from Deref<Target = RpcModule>
pub fn register_method<R, F>(
&mut self,
method_name: &'static str,
callback: F
) -> Result<(), Error> where
F: RpcMethod<R, CallError>,
R: Serialize,
[src]
pub fn register_method<R, F>(
&mut self,
method_name: &'static str,
callback: F
) -> Result<(), Error> where
F: RpcMethod<R, CallError>,
R: Serialize,
[src]Register a new RPC method, which responds with a given callback.
pub fn register_subscription(
&mut self,
subscribe_method_name: &'static str,
unsubscribe_method_name: &'static str
) -> Result<SubscriptionSink, Error>
[src]
pub fn register_subscription(
&mut self,
subscribe_method_name: &'static str,
unsubscribe_method_name: &'static str
) -> Result<SubscriptionSink, Error>
[src]Register a new RPC subscription, with subscribe and unsubscribe methods.
Trait Implementations
impl<Cx> Deref for RpcContextModule<Cx>
[src]
impl<Cx> Deref for RpcContextModule<Cx>
[src]impl<Cx> DerefMut for RpcContextModule<Cx>
[src]
impl<Cx> DerefMut for RpcContextModule<Cx>
[src]pub fn deref_mut(&mut self) -> &mut <RpcContextModule<Cx> as Deref>::Target
[src]
pub fn deref_mut(&mut self) -> &mut <RpcContextModule<Cx> as Deref>::Target
[src]Mutably dereferences the value.
Auto Trait Implementations
impl<Context> !RefUnwindSafe for RpcContextModule<Context>
impl<Context> Send for RpcContextModule<Context> where
Context: Send + Sync,
Context: Send + Sync,
impl<Context> Sync for RpcContextModule<Context> where
Context: Send + Sync,
Context: Send + Sync,
impl<Context> Unpin for RpcContextModule<Context>
impl<Context> !UnwindSafe for RpcContextModule<Context>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,