Struct json_rpc_types::Response [−][src]
pub struct Response<R, E> {
pub jsonrpc: Version,
pub payload: Result<R, Error<E>>,
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.
Fields
jsonrpc: VersionA String specifying the version of the JSON-RPC protocol.
payload: Result<R, Error<E>>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
Implementations
Trait Implementations
impl<'de, R: Deserialize<'de>, E: Deserialize<'de>> Deserialize<'de> for Response<R, E>[src]
impl<'de, R: Deserialize<'de>, E: Deserialize<'de>> Deserialize<'de> for Response<R, E>[src]fn deserialize<D: Deserializer<'de>>(der: D) -> Result<Self, D::Error>[src]
fn deserialize<D: Deserializer<'de>>(der: D) -> Result<Self, D::Error>[src]Deserialize this value from the given Serde deserializer. Read more
impl<R, E> StructuralPartialEq for Response<R, E>[src]
Auto Trait Implementations
impl<R, E> RefUnwindSafe for Response<R, E> where
E: RefUnwindSafe,
R: RefUnwindSafe,
E: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, E> Send for Response<R, E> where
E: Send,
R: Send,
E: Send,
R: Send,
impl<R, E> Sync for Response<R, E> where
E: Sync,
R: Sync,
E: Sync,
R: Sync,
impl<R, E> Unpin for Response<R, E> where
E: Unpin,
R: Unpin,
E: Unpin,
R: Unpin,
impl<R, E> UnwindSafe for Response<R, E> where
E: UnwindSafe,
R: UnwindSafe,
E: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,