Trait ServiceWithClient

Source
pub trait ServiceWithClient {
    type RequestFuture: Future<Output = Result<Value, Value>> + 'static + Send;

    // Required methods
    fn handle_request(
        &mut self,
        client: &mut Client,
        method: &str,
        params: &[Value],
    ) -> Self::RequestFuture;
    fn handle_notification(
        &mut self,
        client: &mut Client,
        method: &str,
        params: &[Value],
    );
}
Expand description

This is a beefed-up version of Service, in which the various handler methods also get access to a Client, which allows them to send requests and notifications to the same msgpack-rpc client that made the original request.

Required Associated Types§

Source

type RequestFuture: Future<Output = Result<Value, Value>> + 'static + Send

The type of future returned by handle_request.

Required Methods§

Source

fn handle_request( &mut self, client: &mut Client, method: &str, params: &[Value], ) -> Self::RequestFuture

Handle a MessagePack-RPC request.

This differs from Service::handle_request in that you also get access to a Client for sending requests and notifications.

Source

fn handle_notification( &mut self, client: &mut Client, method: &str, params: &[Value], )

Handle a MessagePack-RPC notification.

This differs from Service::handle_notification in that you also get access to a Client for sending requests and notifications.

Implementors§