pub trait JsonRpcMethodUnerased<'a, I, O, E> {
// Required methods
fn name(&self) -> &str;
fn create_request(
&self,
params: I,
json_rpc_id: JsonRpcId,
) -> Result<JsonRpcRequest<I>, Error>;
fn parse_json_response_str(
&self,
json_str: &str,
) -> Result<JsonRpcResponse<O, E>, Error>;
fn parse_json_response_value(
&self,
json_value: Value,
) -> Result<JsonRpcResponse<O, E>, Error>;
}Expand description
The trait JsonRpcUnerased is only intended to be used by library developers
The user of this library might want to use the strongly typed generic version or the fully type-erased version
As a library developer, we don’t want to implement the same functionality twice for the same RPC-call.
That is why we introduce the JsonRpcUnerased trait. It fills in the serde_json::Value type wherever either I, O or E should be.
By using this trait, functionality will work for both type of users
Required Methods§
fn name(&self) -> &str
fn create_request( &self, params: I, json_rpc_id: JsonRpcId, ) -> Result<JsonRpcRequest<I>, Error>
fn parse_json_response_str( &self, json_str: &str, ) -> Result<JsonRpcResponse<O, E>, Error>
fn parse_json_response_value( &self, json_value: Value, ) -> Result<JsonRpcResponse<O, E>, Error>
Implementors§
impl<'a, I, O, E> JsonRpcMethodUnerased<'a, I, O, E> for JsonRpcMethod<'a, I, O, E>where
O: DeserializeOwned,
E: DeserializeOwned,
Dummy implementation for when the user uses the generic api