Struct json_rpc_types::Response
source · pub struct Response<R, E, EM = StrBuf<31>> {
pub jsonrpc: Version,
pub payload: Result<R, Error<E, EM>>,
pub id: Option<Id>,
}
Expand description
Response representation.
When omitting id
, it shall be serialized as null
and means you’re unable to identify id
of
Request
.
Note that JSON-RPCv2 specifies that id
must be always present, therefore you’re encouraged to
treat missing id
as error, unless response is error itself, in which case it might be
indication that server treats request as invalid (e.g. unable to parse request’s id).
jsonrpc
may be omitted during deserialization and defaults to v2.
Type parameters:
R
- Type of payload for successful responseE
- Type of optional data forError
.EM
- Type ofE::M
, which is used formessage
field of error.
Fields§
§jsonrpc: Version
A String specifying the version of the JSON-RPC protocol.
payload: Result<R, Error<E, EM>>
Content of response, depending on whether it is success or failure.
id: Option<Id>
An identifier established by the Client.
If not present, it is sent in response to invalid request (e.g. unable to recognize id).
Must be present always, so None
is serialized as null