[][src]Trait easy_jsonrpc::JSONRPCServer

pub trait JSONRPCServer {
    fn handle(&self, method: &str, params: Params) -> Result<Value, Error>;

    fn handle_call(&self, call: Call) -> Option<Output> { ... }
fn handle_parsed(&self, request: Request) -> Option<Response> { ... }
fn handle_raw(&self, request: &str) -> Option<String> { ... } }

Handles jsonrpc calls.

Required methods

fn handle(&self, method: &str, params: Params) -> Result<Value, Error>

type-check params and call method if method exists

Loading content...

Provided methods

fn handle_call(&self, call: Call) -> Option<Output>

extract method name and parameters from call if call is a normal method call, call handle and return result if call is a notification, call handle and return None if call is invalid return a jsonrpc failure

fn handle_parsed(&self, request: Request) -> Option<Response>

Handle a structured jsonrpc request. If the request is a batch, handle the entire batch. return the singe result or a batch of results If the request consists of only notifications, return nothing as per jsonrpc 2.0 spec

fn handle_raw(&self, request: &str) -> Option<String>

Accept request as a jsonrpc formatted string. Call handler. Return result as a jsonrpc formatted string.

Loading content...

Implementors

Loading content...