[−][src]Struct json_rpc_types::Response
Response representation.
When omitting id, it shall be serialized as null and means you're unable to identify id of
Request.
But as JSON-RPCv2 specifies that id must be always present, deserialization fails on it being
missed.
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
impl<R, E> Response<R, E>[src]
pub const fn result(jsonrpc: Version, result: R, id: Option<Id>) -> Self[src]
Creates successful response.
pub const fn error(jsonrpc: Version, error: Error<E>, id: Option<Id>) -> Self[src]
Creates error response.
Trait Implementations
impl<R: Clone, E: Clone> Clone for Response<R, E>[src]
impl<R: Debug, E: Debug> Debug 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]
impl<R: PartialEq, E: PartialEq> PartialEq<Response<R, E>> for Response<R, E>[src]
impl<R: Serialize, E: Serialize> Serialize for Response<R, E>[src]
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> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,