Struct jsonrpc_pubsub::PubSubHandler [−][src]
pub struct PubSubHandler<T: PubSubMetadata, S: Middleware<T> = Noop> { /* fields omitted */ }
Expand description
Publish-Subscribe extension of IoHandler
.
Implementations
Creates new PubSubHandler
pub fn add_subscription<F, G>(
&mut self,
notification: &str,
subscribe: (&str, F),
unsubscribe: (&str, G)
) where
F: SubscribeRpcMethod<T>,
G: UnsubscribeRpcMethod<T>,
[src]
pub fn add_subscription<F, G>(
&mut self,
notification: &str,
subscribe: (&str, F),
unsubscribe: (&str, G)
) where
F: SubscribeRpcMethod<T>,
G: UnsubscribeRpcMethod<T>,
[src]Adds new subscription.
Methods from Deref<Target = MetaIoHandler<T, S>>
Adds new supported synchronous method.
A backward-compatible wrapper.
Adds new supported asynchronous method.
pub fn add_notification<F>(&mut self, name: &str, notification: F) where
F: RpcNotificationSimple,
[src]
pub fn add_notification<F>(&mut self, name: &str, notification: F) where
F: RpcNotificationSimple,
[src]Adds new supported notification
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]
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]
pub fn extend_with<F>(&mut self, methods: F) where
F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
[src]Extend this MetaIoHandler
with methods defined elsewhere.
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
) -> Map<Either<Ready<Option<Response>>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(Option<Response>) -> Option<String>>
[src]
pub fn handle_request(
&self,
request: &str,
meta: T
) -> Map<Either<Ready<Option<Response>>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(Option<Response>) -> Option<String>>
[src]Handle given request asynchronously.
pub fn handle_rpc_request(
&self,
request: Request,
meta: T
) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>
[src]
pub fn handle_rpc_request(
&self,
request: Request,
meta: T
) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>
[src]Handle deserialized RPC request.
pub fn handle_call(
&self,
call: Call,
meta: T
) -> Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>
[src]
pub fn handle_call(
&self,
call: Call,
meta: T
) -> Either<<S as Middleware<T>>::CallFuture, Either<Pin<Box<dyn Future<Output = Option<Output>> + 'static + Send, Global>>, Ready<Option<Output>>>>
[src]Handle single call asynchronously.
Trait Implementations
Auto Trait Implementations
impl<T, S = Noop> !RefUnwindSafe for PubSubHandler<T, S>
impl<T, S> Send for PubSubHandler<T, S>
impl<T, S> Sync for PubSubHandler<T, S>
impl<T, S> Unpin for PubSubHandler<T, S> where
S: Unpin,
impl<T, S = Noop> !UnwindSafe for PubSubHandler<T, S>