Trait RpcHandler

Source
pub trait RpcHandler {
    type Request: RpcRequest;

    // Required method
    fn handle(
        &self,
        request: Self::Request,
    ) -> impl Future<Output = <Self::Request as RpcRequest>::Response> + Send;
}
Expand description

Trait defining a handler for RPC requests. These can registered with the IPC client and will be used to handle incoming RPC requests.

Required Associated Types§

Source

type Request: RpcRequest

The request type that this handler can process.

Required Methods§

Source

fn handle( &self, request: Self::Request, ) -> impl Future<Output = <Self::Request as RpcRequest>::Response> + Send

Handle the request. Any errors that occur should be defined as part of the RpcRequest type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§