pub struct Response<P> {
pub id: Id,
pub jsonrpc: Option<Version>,
pub payload: ResponsePayload<P>,
}Expand description
A JSON-RPC response.
Normally, you shouldn’t need to interact with this directly. It is used to correctly deserialize the response from the server.
Fields§
§id: Id§jsonrpc: Option<Version>§payload: ResponsePayload<P>Implementations§
Source§impl<P> Response<P>
impl<P> Response<P>
pub fn new_v1_result(id: Id, result: P) -> Self
pub fn new_v2_result(id: Id, result: P) -> Self
pub fn new_v1_error(id: Id, error: JsonRpcError) -> Self
pub fn new_v2_error(id: Id, error: JsonRpcError) -> Self
Trait Implementations§
Source§impl<'de, P> Deserialize<'de> for Response<P>where
P: Deserialize<'de>,
impl<'de, P> Deserialize<'de> for Response<P>where
P: Deserialize<'de>,
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
impl<P> StructuralPartialEq for Response<P>
Auto Trait Implementations§
impl<P> Freeze for Response<P>where
P: Freeze,
impl<P> RefUnwindSafe for Response<P>where
P: RefUnwindSafe,
impl<P> Send for Response<P>where
P: Send,
impl<P> Sync for Response<P>where
P: Sync,
impl<P> Unpin for Response<P>where
P: Unpin,
impl<P> UnwindSafe for Response<P>where
P: 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