[][src]Trait xi_rpc::Handler

pub trait Handler {
    type Notification: DeserializeOwned;
    type Request: DeserializeOwned;
    fn handle_notification(&mut self, ctx: &RpcCtx, rpc: Self::Notification);
fn handle_request(
        &mut self,
        ctx: &RpcCtx,
        rpc: Self::Request
    ) -> Result<Value, RemoteError>; fn idle(&mut self, ctx: &RpcCtx, token: usize) { ... } }

A trait for types which can handle RPCs.

Types which implement MethodHandler are also responsible for implementing Parser; Parser is provided when Self::Notification and Self::Request can be used with serde::DeserializeOwned.

Associated Types

Loading content...

Required methods

fn handle_notification(&mut self, ctx: &RpcCtx, rpc: Self::Notification)

fn handle_request(
    &mut self,
    ctx: &RpcCtx,
    rpc: Self::Request
) -> Result<Value, RemoteError>

Loading content...

Provided methods

fn idle(&mut self, ctx: &RpcCtx, token: usize)

Loading content...

Implementors

Loading content...