Trait RequestJsonRpcConvert

Source
pub trait RequestJsonRpcConvert<Request> {
    // Required methods
    fn from_jsonrpc_request(
        value: JsonRpcRequest,
    ) -> Result<Option<Request>, ProtocolError>;
    fn into_jsonrpc_request(&self) -> JsonRpcRequest;
}
Expand description

A request that can convert to and from a JsonRpcRequest.

Required Methods§

Source

fn from_jsonrpc_request( value: JsonRpcRequest, ) -> Result<Option<Request>, ProtocolError>

Deserializes a JsonRpcRequest into Request. Returns a protocol error if the request conversion fails (i.e. request validation fails, unexpected error, etc.). Returns None if the request type is unknown or unsupported, which is synonymous with a “not found” error.

Source

fn into_jsonrpc_request(&self) -> JsonRpcRequest

Serializes a Request into a JsonRpcRequest.

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§