pub struct JsonRpcResponse {
pub jsonrpc: String,
pub id: JsonRpcId,
pub result: Option<Value>,
pub error: Option<JsonRpcError>,
}Expand description
A JSON-RPC 2.0 response: the reply to a request, correlated by matching id.
Exactly one of Self::result / Self::error is populated per the spec.
Fields§
§jsonrpc: StringThe JSON-RPC version, always [JSONRPC_VERSION].
id: JsonRpcIdThe id of the request this response answers.
result: Option<Value>The success payload, when the call succeeded.
None means the result key was ABSENT from the frame; a present "result": null
decodes to Some(Value::Null) (via [deserialize_present_value]). The spec makes the
distinction load-bearing: null is a legal success payload, while a response carrying
neither result nor error is a broken frame — the two must not be conflated.
error: Option<JsonRpcError>The error payload, when the call failed.
Implementations§
Trait Implementations§
Source§impl Clone for JsonRpcResponse
impl Clone for JsonRpcResponse
Source§fn clone(&self) -> JsonRpcResponse
fn clone(&self) -> JsonRpcResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonRpcResponse
impl Debug for JsonRpcResponse
Source§impl<'de> Deserialize<'de> for JsonRpcResponse
impl<'de> Deserialize<'de> for JsonRpcResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for JsonRpcResponse
Source§impl PartialEq for JsonRpcResponse
impl PartialEq for JsonRpcResponse
Source§impl Serialize for JsonRpcResponse
impl Serialize for JsonRpcResponse
impl StructuralPartialEq for JsonRpcResponse
Auto Trait Implementations§
impl Freeze for JsonRpcResponse
impl RefUnwindSafe for JsonRpcResponse
impl Send for JsonRpcResponse
impl Sync for JsonRpcResponse
impl Unpin for JsonRpcResponse
impl UnsafeUnpin for JsonRpcResponse
impl UnwindSafe for JsonRpcResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more