Struct jsonrpc_pubsub::IoDelegate
source · pub struct IoDelegate<T, M = ()>where
T: Send + Sync + 'static,
M: Metadata,{ /* private fields */ }
Expand description
Wire up rpc subscriptions to delegate
struct
Implementations§
source§impl<T, M> IoDelegate<T, M>where
T: Send + Sync + 'static,
M: PubSubMetadata,
impl<T, M> IoDelegate<T, M>where T: Send + Sync + 'static, M: PubSubMetadata,
sourcepub fn new(delegate: Arc<T>) -> Self
pub fn new(delegate: Arc<T>) -> Self
Creates new PubSubIoDelegate
, wrapping the core IoDelegate
sourcepub fn add_subscription<Sub, Unsub, I>(
&mut self,
name: &str,
subscribe: (&str, Sub),
unsubscribe: (&str, Unsub)
)where
Sub: Fn(&T, Params, M, Subscriber) + Send + Sync + 'static,
Unsub: Fn(&T, SubscriptionId, Option<M>) -> I + Send + Sync + 'static,
I: Future<Output = Result<Value>> + Send + 'static,
pub fn add_subscription<Sub, Unsub, I>( &mut self, name: &str, subscribe: (&str, Sub), unsubscribe: (&str, Unsub) )where Sub: Fn(&T, Params, M, Subscriber) + Send + Sync + 'static, Unsub: Fn(&T, SubscriptionId, Option<M>) -> I + Send + Sync + 'static, I: Future<Output = Result<Value>> + Send + 'static,
Adds subscription to the delegate.
sourcepub fn add_method<F, I>(&mut self, name: &str, method: F)where
F: Fn(&T, Params) -> I + Send + Sync + 'static,
I: Future<Output = Result<Value>> + Send + 'static,
pub fn add_method<F, I>(&mut self, name: &str, method: F)where F: Fn(&T, Params) -> I + Send + Sync + 'static, I: Future<Output = Result<Value>> + Send + 'static,
Adds async method to the delegate.
Trait Implementations§
source§impl<T, M> IntoIterator for IoDelegate<T, M>where
T: Send + Sync + 'static,
M: Metadata,
impl<T, M> IntoIterator for IoDelegate<T, M>where T: Send + Sync + 'static, M: Metadata,
§type Item = (String, RemoteProcedure<M>)
type Item = (String, RemoteProcedure<M>)
The type of the elements being iterated over.
§type IntoIter = <IoDelegate<T, M> as IntoIterator>::IntoIter
type IntoIter = <IoDelegate<T, M> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
source§impl<T, M> IoHandlerExtension<M> for IoDelegate<T, M>where
T: Send + Sync + 'static,
M: Metadata,
impl<T, M> IoHandlerExtension<M> for IoDelegate<T, M>where T: Send + Sync + 'static, M: Metadata,
source§fn augment<S: Middleware<M>>(self, handler: &mut MetaIoHandler<M, S>)
fn augment<S: Middleware<M>>(self, handler: &mut MetaIoHandler<M, S>)
Extend given
handler
with additional methods.Auto Trait Implementations§
impl<T, M = ()> !RefUnwindSafe for IoDelegate<T, M>
impl<T, M> Send for IoDelegate<T, M>
impl<T, M> Sync for IoDelegate<T, M>where M: Sync,
impl<T, M> Unpin for IoDelegate<T, M>where M: Unpin,
impl<T, M = ()> !UnwindSafe for IoDelegate<T, M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more