Struct jsonrpc_core::IoHandler
source · [−]Expand description
Simplified IoHandler
with no Metadata
associated with each request.
Implementations
sourceimpl IoHandler
impl IoHandler
sourcepub fn with_compatibility(compatibility: Compatibility) -> Self
pub fn with_compatibility(compatibility: Compatibility) -> Self
Creates new IoHandler
without any metadata compatible with specified protocol version.
sourceimpl<M: Metadata + Default> IoHandler<M>
impl<M: Metadata + Default> IoHandler<M>
sourcepub fn handle_request(
&self,
request: &str
) -> FutureResult<FutureResponse, FutureOutput>
pub fn handle_request(
&self,
request: &str
) -> FutureResult<FutureResponse, FutureOutput>
Handle given string request asynchronously.
sourcepub fn handle_rpc_request(
&self,
request: Request
) -> FutureRpcResult<FutureResponse, FutureOutput>
pub fn handle_rpc_request(
&self,
request: Request
) -> FutureRpcResult<FutureResponse, FutureOutput>
Handle deserialized RPC request asynchronously.
sourcepub fn handle_call(
&self,
call: Call
) -> Either<FutureOutput, Either<FutureOutput, FutureResult<Option<Output>, ()>>>
pub fn handle_call(
&self,
call: Call
) -> Either<FutureOutput, Either<FutureOutput, FutureResult<Option<Output>, ()>>>
Handle single Call asynchronously.
sourcepub fn handle_request_sync(&self, request: &str) -> Option<String>
pub fn handle_request_sync(&self, request: &str) -> Option<String>
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.
Methods from Deref<Target = MetaIoHandler<M>>
sourcepub fn add_method<F>(&mut self, name: &str, method: F) where
F: RpcMethodSimple,
pub fn add_method<F>(&mut self, name: &str, method: F) where
F: RpcMethodSimple,
Adds new supported asynchronous method
sourcepub fn add_notification<F>(&mut self, name: &str, notification: F) where
F: RpcNotificationSimple,
pub fn add_notification<F>(&mut self, name: &str, notification: F) where
F: RpcNotificationSimple,
Adds new supported notification
sourcepub fn add_method_with_meta<F>(&mut self, name: &str, method: F) where
F: RpcMethod<T>,
pub fn add_method_with_meta<F>(&mut self, name: &str, method: F) where
F: RpcMethod<T>,
Adds new supported asynchronous method with metadata support.
sourcepub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F) where
F: RpcNotification<T>,
pub fn add_notification_with_meta<F>(&mut self, name: &str, notification: F) where
F: RpcNotification<T>,
Adds new supported notification with metadata support.
sourcepub fn extend_with<F>(&mut self, methods: F) where
F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
pub fn extend_with<F>(&mut self, methods: F) where
F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
Extend this MetaIoHandler
with methods defined elsewhere.
sourcepub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>
pub fn handle_request_sync(&self, request: &str, meta: T) -> Option<String>
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.
sourcepub fn handle_request(
&self,
request: &str,
meta: T
) -> FutureResult<S::Future, S::CallFuture>
pub fn handle_request(
&self,
request: &str,
meta: T
) -> FutureResult<S::Future, S::CallFuture>
Handle given request asynchronously.
sourcepub fn handle_rpc_request(
&self,
request: Request,
meta: T
) -> FutureRpcResult<S::Future, S::CallFuture>
pub fn handle_rpc_request(
&self,
request: Request,
meta: T
) -> FutureRpcResult<S::Future, S::CallFuture>
Handle deserialized RPC request.
sourcepub fn handle_call(
&self,
call: Call,
meta: T
) -> Either<S::CallFuture, Either<FutureOutput, FutureResult<Option<Output>, ()>>>
pub fn handle_call(
&self,
call: Call,
meta: T
) -> Either<S::CallFuture, Either<FutureOutput, FutureResult<Option<Output>, ()>>>
Handle single call asynchronously.
Trait Implementations
sourceimpl<M: Metadata> Deref for IoHandler<M>
impl<M: Metadata> Deref for IoHandler<M>
type Target = MetaIoHandler<M>
type Target = MetaIoHandler<M>
The resulting type after dereferencing.
sourceimpl<T: Metadata> IntoIterator for IoHandler<T>
impl<T: Metadata> IntoIterator for IoHandler<T>
type Item = <MetaIoHandler<T> as IntoIterator>::Item
type Item = <MetaIoHandler<T> as IntoIterator>::Item
The type of the elements being iterated over.
type IntoIter = <MetaIoHandler<T> as IntoIterator>::IntoIter
type IntoIter = <MetaIoHandler<T> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
sourceimpl<M: Metadata> IoHandlerExtension<M> for IoHandler<M>
impl<M: Metadata> IoHandlerExtension<M> for IoHandler<M>
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<M = ()> !RefUnwindSafe for IoHandler<M>
impl<M> Send for IoHandler<M>
impl<M> Sync for IoHandler<M>
impl<M> Unpin for IoHandler<M>
impl<M = ()> !UnwindSafe for IoHandler<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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more