pub struct Response {
pub jsonrpc: Option<String>,
pub version: Option<String>,
pub result: Option<Value>,
pub error: Option<Error>,
pub id: Option<Id>,
}Expand description
JSON-RPC response object
Fields§
§jsonrpc: Option<String>JSON-RPC version (2.0)
version: Option<String>JSON-RPC version (1.1)
result: Option<Value>Result of the method invocation (on success)
error: Option<Error>Error object (on failure)
id: Option<Id>Request identifier
Implementations§
Source§impl Response
impl Response
Sourcepub fn success(result: Value, id: Option<Id>) -> Self
pub fn success(result: Value, id: Option<Id>) -> Self
Alias for the current version: Create a new JSON-RPC 2.0 success response
Sourcepub fn error(error: Error, id: Option<Id>) -> Self
pub fn error(error: Error, id: Option<Id>) -> Self
Alias for the current version: Create a new JSON-RPC 2.0 error response
Sourcepub fn success_v2(result: Value, id: Option<Id>) -> Self
pub fn success_v2(result: Value, id: Option<Id>) -> Self
Create a new JSON-RPC 2.0 success response
Sourcepub fn success_v1_1(result: Value, id: Option<Id>) -> Self
pub fn success_v1_1(result: Value, id: Option<Id>) -> Self
Create a new JSON-RPC 1.1 success response
Sourcepub fn error_v1_1(error: Error, id: Option<Id>) -> Self
pub fn error_v1_1(error: Error, id: Option<Id>) -> Self
Create a new JSON-RPC 1.1 error response
Sourcepub fn success_v1(result: Value, id: Option<Id>) -> Self
pub fn success_v1(result: Value, id: Option<Id>) -> Self
Create a new JSON-RPC 1.0 success response
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if this is a success response
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
impl StructuralPartialEq for Response
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin 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