Struct jsonrpc_macros::IoDelegate
[−]
[src]
pub struct IoDelegate<T, M = ()> where
T: Send + Sync + 'static,
M: Metadata, { /* fields omitted */ }
A set of RPC methods and notifications tied to single delegate
struct.
Methods
impl<T, M> IoDelegate<T, M> where
T: Send + Sync + 'static,
M: Metadata,
[src]
T: Send + Sync + 'static,
M: Metadata,
fn new(delegate: Arc<T>) -> Self
Creates new IoDelegate
fn add_alias(&mut self, from: &str, to: &str)
Adds an alias to existing method. NOTE: Aliases are not transitive, i.e. you cannot create alias to an alias.
fn add_method<F>(&mut self, name: &str, method: F) where
F: Fn(&T, Params) -> Result<Value, Error>,
F: Send + Sync + 'static,
F: Fn(&T, Params) -> Result<Value, Error>,
F: Send + Sync + 'static,
Adds sync method to the delegate.
fn add_async_method<F>(&mut self, name: &str, method: F) where
F: Fn(&T, Params) -> BoxFuture<Value, Error>,
F: Send + Sync + 'static,
F: Fn(&T, Params) -> BoxFuture<Value, Error>,
F: Send + Sync + 'static,
Adds async method to the delegate.
fn add_method_with_meta<F>(&mut self, name: &str, method: F) where
F: Fn(&T, Params, M) -> BoxFuture<Value, Error>,
F: Send + Sync + 'static,
F: Fn(&T, Params, M) -> BoxFuture<Value, Error>,
F: Send + Sync + 'static,
Adds async method with metadata to the delegate.
fn add_notification<F>(&mut self, name: &str, notification: F) where
F: Fn(&T, Params),
F: Send + Sync + 'static,
F: Fn(&T, Params),
F: Send + Sync + 'static,
Adds notification to the delegate.
impl<T, M> IoDelegate<T, M> where
T: Send + Sync + 'static,
M: PubSubMetadata,
[src]
T: Send + Sync + 'static,
M: PubSubMetadata,
fn add_subscription<Sub, Unsub>(
&mut self,
name: &str,
subscribe: (&str, Sub),
unsubscribe: (&str, Unsub)
) where
Sub: Fn(&T, Params, M, Subscriber),
Sub: Send + Sync + 'static,
Unsub: Fn(&T, SubscriptionId) -> BoxFuture<Value, Error>,
Unsub: Send + Sync + 'static,
&mut self,
name: &str,
subscribe: (&str, Sub),
unsubscribe: (&str, Unsub)
) where
Sub: Fn(&T, Params, M, Subscriber),
Sub: Send + Sync + 'static,
Unsub: Fn(&T, SubscriptionId) -> BoxFuture<Value, Error>,
Unsub: Send + Sync + 'static,
Adds subscription to the delegate.
Trait Implementations
impl<T, M> Into<HashMap<String, RemoteProcedure<M>>> for IoDelegate<T, M> where
T: Send + Sync + 'static,
M: Metadata,
[src]
T: Send + Sync + 'static,
M: Metadata,
fn into(self) -> HashMap<String, RemoteProcedure<M>>
Performs the conversion.