Struct jsonrpc_core::delegates::IoDelegate
source · [−]pub struct IoDelegate<T, M = ()> where
T: Send + Sync + 'static,
M: Metadata, { /* private fields */ }
Expand description
A set of RPC methods and notifications tied to single delegate
struct.
Implementations
sourceimpl<T, M> IoDelegate<T, M> where
T: Send + Sync + 'static,
M: Metadata,
impl<T, M> IoDelegate<T, M> where
T: Send + Sync + 'static,
M: Metadata,
sourcepub fn add_alias(&mut self, from: &str, to: &str)
pub 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.
sourcepub 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,
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,
Adds async method to the delegate.
sourcepub 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,
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,
Adds async method with metadata to the delegate.
Trait Implementations
sourceimpl<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,
sourceimpl<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,
sourcefn 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>
impl<T, M> Unpin for IoDelegate<T, M>
impl<T, M = ()> !UnwindSafe for IoDelegate<T, M>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more