jsonrpc_pubsub

Struct 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,

Source

pub fn new(delegate: Arc<T>) -> Self

Creates new PubSubIoDelegate, wrapping the core IoDelegate

Source

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.

Source

pub fn add_alias(&mut self, from: &str, to: &str)

Adds an alias to existing method.

Source

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.

Source

pub fn add_method_with_meta<F, I>(&mut self, name: &str, method: F)
where F: Fn(&T, Params, M) -> I + Send + Sync + 'static, I: Future<Output = Result<Value>> + Send + 'static,

Adds async method with metadata to the delegate.

Source

pub fn add_notification<F>(&mut self, name: &str, notification: F)
where F: Fn(&T, Params) + Send + Sync + 'static,

Adds notification to the delegate.

Trait Implementations§

Source§

impl<T, M> IntoIterator for IoDelegate<T, M>
where T: Send + Sync + 'static, M: Metadata,

Source§

type Item = (String, RemoteProcedure<M>)

The type of the elements being iterated over.
Source§

type IntoIter = <IoDelegate<T, M> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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>)

Extend given handler with additional methods.

Auto Trait Implementations§

§

impl<T, M> Freeze for IoDelegate<T, M>

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V