[][src]Struct jsonrpc_core::MetaIoHandler

pub struct MetaIoHandler<T: Metadata, S: Middleware<T> = Noop> { /* fields omitted */ }

Request handler

By default compatible only with jsonrpc v2

Implementations

impl<T: Metadata> MetaIoHandler<T>[src]

pub fn with_compatibility(compatibility: Compatibility) -> Self[src]

Creates new MetaIoHandler compatible with specified protocol version.

impl<T: Metadata, S: Middleware<T>> MetaIoHandler<T, S>[src]

pub fn new(compatibility: Compatibility, middleware: S) -> Self[src]

Creates new MetaIoHandler

pub fn with_middleware(middleware: S) -> Self[src]

Creates new MetaIoHandler with specified middleware.

pub fn add_alias(&mut self, alias: &str, other: &str)[src]

Adds an alias to a method.

pub fn add_method<F>(&mut self, name: &str, method: F) where
    F: RpcMethodSimple
[src]

Adds new supported asynchronous method

pub fn add_notification<F>(&mut self, name: &str, notification: F) where
    F: RpcNotificationSimple
[src]

Adds new supported notification

pub fn add_method_with_meta<F>(&mut self, name: &str, method: F) where
    F: RpcMethod<T>, 
[src]

Adds new supported asynchronous method with metadata support.

pub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F) where
    F: RpcNotification<T>, 
[src]

Adds new supported notification with metadata support.

pub fn extend_with<F>(&mut self, methods: F) where
    F: IntoIterator<Item = (String, RemoteProcedure<T>)>, 
[src]

Extend this MetaIoHandler with methods defined elsewhere.

pub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>[src]

Handle given request synchronously - will block until response is available. If you have any asynchronous methods in your RPC it is much wiser to use handle_request instead and deal with asynchronous requests in a non-blocking fashion.

pub fn handle_request(
    &self,
    request: &str,
    meta: T
) -> FutureResult<S::Future, S::CallFuture>
[src]

Handle given request asynchronously.

pub fn handle_rpc_request(
    &self,
    request: Request,
    meta: T
) -> FutureRpcResult<S::Future, S::CallFuture>
[src]

Handle deserialized RPC request.

pub fn handle_call(
    &self,
    call: Call,
    meta: T
) -> Either<S::CallFuture, Either<FutureOutput, FutureResult<Option<Output>, ()>>>
[src]

Handle single call asynchronously.

pub fn iter(&self) -> impl Iterator<Item = (&String, &RemoteProcedure<T>)>[src]

Returns an iterator visiting all methods in arbitrary order.

Trait Implementations

impl<T: Clone + Metadata, S: Clone + Middleware<T>> Clone for MetaIoHandler<T, S>[src]

impl<T: Debug + Metadata, S: Debug + Middleware<T>> Debug for MetaIoHandler<T, S>[src]

impl<T: Metadata> Default for MetaIoHandler<T>[src]

impl From<IoHandler<()>> for MetaIoHandler<()>[src]

impl<T: Metadata, S: Middleware<T>> IntoIterator for MetaIoHandler<T, S>[src]

type Item = (String, RemoteProcedure<T>)

The type of the elements being iterated over.

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

Which kind of iterator are we turning this into?

impl<'a, T: Metadata, S: Middleware<T>> IntoIterator for &'a MetaIoHandler<T, S>[src]

type Item = (&'a String, &'a RemoteProcedure<T>)

The type of the elements being iterated over.

type IntoIter = Iter<'a, String, RemoteProcedure<T>>

Which kind of iterator are we turning this into?

impl<M: Metadata, S2: Middleware<M>> IoHandlerExtension<M> for MetaIoHandler<M, S2>[src]

Auto Trait Implementations

impl<T, S = Noop> !RefUnwindSafe for MetaIoHandler<T, S>

impl<T, S> Send for MetaIoHandler<T, S>

impl<T, S> Sync for MetaIoHandler<T, S>

impl<T, S> Unpin for MetaIoHandler<T, S> where
    S: Unpin

impl<T, S = Noop> !UnwindSafe for MetaIoHandler<T, S>

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.