pub struct JsonRpcResponse<R = Value> {
pub jsonrpc: Version,
pub id: RequestId,
pub body: JsonRpcResponseBody<R>,
}Expand description
A JSON-RPC 2.0 response envelope.
Exactly one of result or error is present — enforced by the
untagged JsonRpcResponseBody enum.
R is the method-specific result type. Generic callers use
serde_json::Value.
Fields§
§jsonrpc: VersionProtocol version; must serialize to the literal "2.0".
id: RequestIdCorrelation id copied from the matching request.
body: JsonRpcResponseBody<R>Either result or error, never both, never neither.
Trait Implementations§
Source§impl<R> Clone for JsonRpcResponse<R>where
R: Clone,
impl<R> Clone for JsonRpcResponse<R>where
R: Clone,
Source§fn clone(&self) -> JsonRpcResponse<R>
fn clone(&self) -> JsonRpcResponse<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 JsonRpcResponse<R>where
R: Debug,
impl<R> Debug for JsonRpcResponse<R>where
R: Debug,
Source§impl<'de, R> Deserialize<'de> for JsonRpcResponse<R>where
R: Deserialize<'de>,
impl<'de, R> Deserialize<'de> for JsonRpcResponse<R>where
R: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcResponse<R>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonRpcResponse<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 JsonRpcResponse<R>where
R: Serialize,
impl<R> Serialize for JsonRpcResponse<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 JsonRpcResponse<R>where
R: Freeze,
impl<R> RefUnwindSafe for JsonRpcResponse<R>where
R: RefUnwindSafe,
impl<R> Send for JsonRpcResponse<R>where
R: Send,
impl<R> Sync for JsonRpcResponse<R>where
R: Sync,
impl<R> Unpin for JsonRpcResponse<R>where
R: Unpin,
impl<R> UnsafeUnpin for JsonRpcResponse<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for JsonRpcResponse<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