Struct jsonrpc_core::MetaIoHandler
[−]
[src]
pub struct MetaIoHandler<T: Metadata> { /* fields omitted */ }
Request handler
By default compatible only with jsonrpc v2
Methods
impl<T: Metadata> MetaIoHandler<T>
[src]
fn new() -> Self
Creates new MetaIoHandler
fn with_compatibility(compatibility: Compatibility) -> Self
Creates new MetaIoHandler
compatible with specified protocol version.
fn add_method<F>(&mut self, name: &str, method: F) where F: RpcMethodSync
Adds new supported synchronous method
fn add_async_method<F>(&mut self, name: &str, method: F) where F: RpcMethodSimple
Adds new supported asynchronous method
fn add_notification<F>(&mut self, name: &str, notification: F) where F: RpcNotificationSimple
Adds new supported notification
fn add_method_with_meta<F>(&mut self, name: &str, method: F) where F: RpcMethod<T>
Adds new supported asynchronous method with metadata support.
fn add_notification_with_meta<F>(&mut self, name: &str, notification: F) where F: RpcNotification<T>
Adds new supported notification with metadata support.
fn extend_with<F>(&mut self, methods: F) where F: Into<HashMap<String, RemoteProcedure<T>>>
Extend this MetaIoHandler
with methods defined elsewhere.
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.
fn handle_request(&self,
request: &str,
meta: T)
-> BoxFuture<Option<String>, ()>
request: &str,
meta: T)
-> BoxFuture<Option<String>, ()>
Handle given request asynchronously.
Trait Implementations
impl<T: Default + Metadata> Default for MetaIoHandler<T>
[src]
fn default() -> MetaIoHandler<T>
Returns the "default value" for a type. Read more