pub struct Response {
pub jsonrpc: String,
pub id: RequestId,
pub result: Option<Value>,
pub error: Option<ResponseError>,
}Expand description
One JSON-RPC response. Either result or error is set;
never both.
Decoding does not enforce the “never both” half: a message carrying both
decodes with both set, and consumers check error first. A message with
an id but neither key is not a response at all —
Message::from_json rejects it as MessageDecodeError::Malformed.
A successful result of JSON null (e.g. shutdown’s) deserializes to
result: None, indistinguishable from an absent key.
Fields§
§jsonrpc: StringProtocol version; JSONRPC_VERSION on everything we build.
id: RequestIdThe id of the Request this answers, echoed unchanged.
result: Option<Value>The success payload.
error: Option<ResponseError>The failure payload.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
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
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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