JsonRpcHandler

Trait JsonRpcHandler 

Source
pub trait JsonRpcHandler: Send + Sync {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        params: Option<RequestParams>,
        session_context: Option<SessionContext>,
    ) -> Pin<Box<dyn Future<Output = JsonRpcResult<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn handle_notification<'life0, 'life1, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        params: Option<RequestParams>,
        session_context: Option<SessionContext>,
    ) -> Pin<Box<dyn Future<Output = JsonRpcResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn supported_methods(&self) -> Vec<String> { ... }
}
Expand description

Trait for handling JSON-RPC method calls

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, params: Option<RequestParams>, session_context: Option<SessionContext>, ) -> Pin<Box<dyn Future<Output = JsonRpcResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a JSON-RPC method call with optional session context

Provided Methods§

Source

fn handle_notification<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, params: Option<RequestParams>, session_context: Option<SessionContext>, ) -> Pin<Box<dyn Future<Output = JsonRpcResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a JSON-RPC notification with optional session context (optional - default does nothing)

Source

fn supported_methods(&self) -> Vec<String>

List supported methods (optional - used for introspection)

Implementors§