Struct jsonrpc::Response [−][src]
pub struct Response { pub result: Option<Value>, pub error: Option<RpcError>, pub id: Value, pub jsonrpc: Option<String>, }
A JSONRPC response object
Fields
result: Option<Value>
A result if there is one, or null
error: Option<RpcError>
An error if there is one, or null
id: Value
Identifier for this Request, which should match that of the request
jsonrpc: Option<String>
jsonrpc field, MUST be “2.0”
Implementations
impl Response
[src]
impl Response
[src]pub fn result<T: DeserializeOwned>(&self) -> Result<T, Error>
[src]
Extract the result from a response
pub fn into_result<T: DeserializeOwned>(self) -> Result<T, Error>
[src]
Extract the result from a response, consuming the response
pub fn check_error(self) -> Result<(), Error>
[src]
Return the RPC error, if there was one, but do not check the result
pub fn is_none(&self) -> bool
[src]
Returns whether or not the result
field is empty
Trait Implementations
impl<'de> Deserialize<'de> for Response
[src]
impl<'de> Deserialize<'de> for Response
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,