pub enum RpcResponse {
Success(RpcSuccessResponse),
Error(RpcErrorResponse),
}Expand description
Represents a JSON-RPC 2.0 Response object. It can be either a success or an error response. https://www.jsonrpc.org/specification#response_object
Variants§
Success(RpcSuccessResponse)
Represents a successful JSON-RPC response.
Error(RpcErrorResponse)
Represents a JSON-RPC error response.
Implementations§
Source§impl RpcResponse
impl RpcResponse
pub fn from_success(id: RpcId, result: Value) -> Self
pub fn from_error(id: RpcId, error: RpcError) -> Self
Source§impl RpcResponse
impl RpcResponse
Trait Implementations§
Source§impl Clone for RpcResponse
impl Clone for RpcResponse
Source§fn clone(&self) -> RpcResponse
fn clone(&self) -> RpcResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RpcResponse
impl Debug for RpcResponse
Source§impl<'de> Deserialize<'de> for RpcResponse
impl<'de> Deserialize<'de> for RpcResponse
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
Source§impl From<CallError> for RpcResponse
impl From<CallError> for RpcResponse
Source§impl From<CallSuccess> for RpcResponse
impl From<CallSuccess> for RpcResponse
Source§fn from(call_success: CallSuccess) -> Self
fn from(call_success: CallSuccess) -> Self
Converts a successful router CallSuccess into a JSON-RPC RpcResponse::Success.
Source§impl From<Result<CallSuccess, CallError>> for RpcResponse
impl From<Result<CallSuccess, CallError>> for RpcResponse
Source§fn from(call_result: CallResult) -> Self
fn from(call_result: CallResult) -> Self
Converts a router CallResult (which is Result<CallSuccess, CallError>)
into the appropriate JSON-RPC RpcResponse.
Source§impl PartialEq for RpcResponse
impl PartialEq for RpcResponse
Source§impl Serialize for RpcResponse
impl Serialize for RpcResponse
impl StructuralPartialEq for RpcResponse
Auto Trait Implementations§
impl Freeze for RpcResponse
impl RefUnwindSafe for RpcResponse
impl Send for RpcResponse
impl Sync for RpcResponse
impl Unpin for RpcResponse
impl UnwindSafe for RpcResponse
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