Type Alias rings_node::jsonrpc::handler::default::HandlerType
source · pub type HandlerType = MetaIoHandler<RpcMeta>;
Expand description
Type of Messagehandler
Aliased Type§
struct HandlerType { /* private fields */ }
Implementations§
§impl<T> MetaIoHandler<T, Noop>where
T: Metadata,
impl<T> MetaIoHandler<T, Noop>where T: Metadata,
pub fn with_compatibility(
compatibility: Compatibility
) -> MetaIoHandler<T, Noop>
pub fn with_compatibility( compatibility: Compatibility ) -> MetaIoHandler<T, Noop>
Creates new MetaIoHandler
compatible with specified protocol version.
§impl<T, S> MetaIoHandler<T, S>where
T: Metadata,
S: Middleware<T>,
impl<T, S> MetaIoHandler<T, S>where T: Metadata, S: Middleware<T>,
pub fn new(compatibility: Compatibility, middleware: S) -> MetaIoHandler<T, S>
pub fn new(compatibility: Compatibility, middleware: S) -> MetaIoHandler<T, S>
Creates new MetaIoHandler
pub fn with_middleware(middleware: S) -> MetaIoHandler<T, S>
pub fn with_middleware(middleware: S) -> MetaIoHandler<T, S>
Creates new MetaIoHandler
with specified middleware.
pub fn add_sync_method<F>(&mut self, name: &str, method: F)where
F: RpcMethodSync,
pub fn add_sync_method<F>(&mut self, name: &str, method: F)where F: RpcMethodSync,
Adds new supported synchronous method.
A backward-compatible wrapper.
pub fn add_method<F>(&mut self, name: &str, method: F)where
F: RpcMethodSimple,
pub fn add_method<F>(&mut self, name: &str, method: F)where F: RpcMethodSimple,
Adds new supported asynchronous method.
pub fn add_notification<F>(&mut self, name: &str, notification: F)where
F: RpcNotificationSimple,
pub fn add_notification<F>(&mut self, name: &str, notification: F)where F: RpcNotificationSimple,
Adds new supported notification
pub fn add_method_with_meta<F>(&mut self, name: &str, method: F)where
F: RpcMethod<T>,
pub fn add_method_with_meta<F>(&mut self, name: &str, method: F)where F: RpcMethod<T>,
Adds new supported asynchronous method with metadata support.
pub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F)where
F: RpcNotification<T>,
pub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F)where F: RpcNotification<T>,
Adds new supported notification with metadata support.
pub fn extend_with<F>(&mut self, methods: F)where
F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
pub fn extend_with<F>(&mut self, methods: F)where F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
Extend this MetaIoHandler
with methods defined elsewhere.
pub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>
pub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>
Handle given request synchronously - will block until response is available.
If you have any asynchronous methods in your RPC it is much wiser to use
handle_request
instead and deal with asynchronous requests in a non-blocking fashion.
pub fn handle_request(
&self,
request: &str,
meta: T
) -> Map<Either<Ready<Option<Response>>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>, fn(_: Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>>, fn(_: Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(_: Option<Response>) -> Option<String>>
pub fn handle_request( &self, request: &str, meta: T ) -> Map<Either<Ready<Option<Response>>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>, fn(_: Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>>, fn(_: Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(_: Option<Response>) -> Option<String>>
Handle given request asynchronously.
pub fn handle_rpc_request(
&self,
request: Request,
meta: T
) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>, fn(_: Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>>, fn(_: Vec<Option<Output>, Global>) -> Option<Response>>>>
pub fn handle_rpc_request( &self, request: Request, meta: T ) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>, fn(_: Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + Send, Global>>, Ready<Option<Output>>>>>, fn(_: Vec<Option<Output>, Global>) -> Option<Response>>>>
Handle deserialized RPC request.