pub enum JsonRpcResponseBody<R> {
Success {
result: R,
},
Error {
error: JsonRpcError,
},
}Expand description
The body of a response: either a successful result or an error.
Uses serde(untagged) so the JSON output is flat — {"result": ...}
or {"error": ...} — matching the JSON-RPC 2.0 spec.
Variants§
Success
The method succeeded; result carries the response.
Fields
§
result: RThe method-specific result payload.
Error
The method failed; error carries the failure details.
Fields
§
error: JsonRpcErrorThe error envelope.
Trait Implementations§
Source§impl<R> Clone for JsonRpcResponseBody<R>where
R: Clone,
impl<R> Clone for JsonRpcResponseBody<R>where
R: Clone,
Source§fn clone(&self) -> JsonRpcResponseBody<R>
fn clone(&self) -> JsonRpcResponseBody<R>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<R> Debug for JsonRpcResponseBody<R>where
R: Debug,
impl<R> Debug for JsonRpcResponseBody<R>where
R: Debug,
Source§impl<'de, R> Deserialize<'de> for JsonRpcResponseBody<R>where
R: Deserialize<'de>,
impl<'de, R> Deserialize<'de> for JsonRpcResponseBody<R>where
R: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcResponseBody<R>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcResponseBody<R>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<R> Serialize for JsonRpcResponseBody<R>where
R: Serialize,
impl<R> Serialize for JsonRpcResponseBody<R>where
R: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl<R> Freeze for JsonRpcResponseBody<R>where
R: Freeze,
impl<R> RefUnwindSafe for JsonRpcResponseBody<R>where
R: RefUnwindSafe,
impl<R> Send for JsonRpcResponseBody<R>where
R: Send,
impl<R> Sync for JsonRpcResponseBody<R>where
R: Sync,
impl<R> Unpin for JsonRpcResponseBody<R>where
R: Unpin,
impl<R> UnsafeUnpin for JsonRpcResponseBody<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for JsonRpcResponseBody<R>where
R: UnwindSafe,
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