Struct jsonrpc_core::delegates::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.

Implementations

impl<T, M> IoDelegate<T, M> where
    T: Send + Sync + 'static,
    M: Metadata
[src]

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

Creates new IoDelegate

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

Adds an alias to existing method. NOTE: Aliases are not transitive, i.e. you cannot create alias to an alias.

pub fn add_method<F, I>(&mut self, name: &str, method: F) where
    F: Fn(&T, Params) -> I,
    I: IntoFuture<Item = Value, Error = Error>,
    F: Send + Sync + 'static,
    I::Future: Send + 'static, 
[src]

Adds async method to the delegate.

pub fn add_method_with_meta<F, I>(&mut self, name: &str, method: F) where
    F: Fn(&T, Params, M) -> I,
    I: IntoFuture<Item = Value, Error = Error>,
    F: Send + Sync + 'static,
    I::Future: Send + 'static, 
[src]

Adds async method with metadata to the delegate.

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

Adds notification to the delegate.

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

Adds notification with metadata to the delegate.

Trait Implementations

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

type Item = (String, RemoteProcedure<M>)

The type of the elements being iterated over.

type IntoIter = IntoIter<String, RemoteProcedure<M>>

Which kind of iterator are we turning this into?

impl<T, M> IoHandlerExtension<M> for IoDelegate<T, M> where
    T: Send + Sync + 'static,
    M: Metadata
[src]

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>

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

impl<T, M = ()> !UnwindSafe for IoDelegate<T, M>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.