pub struct RpcResponse {
pub id: Option<JsonValue>,
pub command: Option<String>,
pub result: Result<RpcResponseData, String>,
}Expand description
{id?, type:"response", command, success, data? | error} in wire key order.
Fields§
§id: Option<JsonValue>Correlation id.
command: Option<String>Command type (None for a command without type).
result: Result<RpcResponseData, String>Outcome.
Implementations§
Source§impl RpcResponse
impl RpcResponse
Sourcepub fn success(
id: Option<JsonValue>,
command: impl Into<String>,
data: RpcResponseData,
) -> Self
pub fn success( id: Option<JsonValue>, command: impl Into<String>, data: RpcResponseData, ) -> Self
A success reply.
Sourcepub fn error(
id: Option<JsonValue>,
command: Option<String>,
error: impl Into<String>,
) -> Self
pub fn error( id: Option<JsonValue>, command: Option<String>, error: impl Into<String>, ) -> Self
An error reply.
Sourcepub fn from_value(value: &JsonValue) -> Option<Self>
pub fn from_value(value: &JsonValue) -> Option<Self>
Decodes a reply object.
Trait Implementations§
Source§impl Clone for RpcResponse
impl Clone for RpcResponse
Source§impl Debug for RpcResponse
impl Debug for 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 UnsafeUnpin 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