Struct jsonrpc_pubsub::PubSubHandler [−][src]
Publish-Subscribe extension of IoHandler
.
Implementations
impl<T: PubSubMetadata, S: Middleware<T>> PubSubHandler<T, S>
[src]
pub fn new(handler: MetaIoHandler<T, S>) -> Self
[src]
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]
&mut self,
notification: &str,
subscribe: (&str, F),
unsubscribe: (&str, G)
) where
F: SubscribeRpcMethod<T>,
G: UnsubscribeRpcMethod<T>,
Adds new subscription.
Methods from Deref<Target = MetaIoHandler<T, S>>
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]
F: RpcMethodSimple,
Adds new supported asynchronous method
pub fn add_notification<F>(&mut self, name: &str, notification: F) where
F: RpcNotificationSimple,
[src]
F: RpcNotificationSimple,
Adds new supported notification
pub fn add_method_with_meta<F>(&mut self, name: &str, method: F) where
F: RpcMethod<T>,
[src]
F: RpcMethod<T>,
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]
F: RpcNotification<T>,
Adds new supported notification with metadata support.
pub fn extend_with<F>(&mut self, methods: F) where
F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
[src]
F: IntoIterator<Item = (String, RemoteProcedure<T>)>,
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
) -> Map<Either<FutureResult<Option<Response>, ()>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(Option<Response>) -> Option<String>>
[src]
&self,
request: &str,
meta: T
) -> Map<Either<FutureResult<Option<Response>, ()>, Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>>, fn(Option<Response>) -> Option<String>>
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<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>
[src]
&self,
request: Request,
meta: T
) -> Either<<S as Middleware<T>>::Future, Either<Map<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, fn(Option<Output>) -> Option<Response>>, Map<JoinAll<Vec<Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>, Global>>, fn(Vec<Option<Output>, Global>) -> Option<Response>>>>
Handle deserialized RPC request.
pub fn handle_call(
&self,
call: Call,
meta: T
) -> Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>
[src]
&self,
call: Call,
meta: T
) -> Either<<S as Middleware<T>>::CallFuture, Either<Box<dyn Future<Error = (), Item = Option<Output>> + 'static + Send, Global>, FutureResult<Option<Output>, ()>>>
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: PubSubMetadata> Default for PubSubHandler<T>
[src]
impl<T: PubSubMetadata, S: Middleware<T>> Deref for PubSubHandler<T, S>
[src]
type Target = MetaIoHandler<T, S>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<T: PubSubMetadata, S: Middleware<T>> DerefMut for PubSubHandler<T, S>
[src]
impl<T: PubSubMetadata, S: Middleware<T>> Into<MetaIoHandler<T, S>> for PubSubHandler<T, S>
[src]
fn into(self) -> MetaIoHandler<T, S>
[src]
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,
S: Unpin,
impl<T, S = Noop> !UnwindSafe for PubSubHandler<T, S>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,