pub struct WsResponse {
pub id: Uuid,
pub result: Option<Value>,
pub error: Option<String>,
}Expand description
A response from server to client, matching a request id.
§Serde invariant
result: Some(Value::Null) and result: None are equivalent on the
wire. Both serialize to a JSON object without a result field
(the Some(Null) case via the standard serde rule that JSON null
deserializes back as None for Option<T>). This is intentional and
matches JSON-RPC convention. Pinned by a unit test below
(ws_response_some_null_equals_none_on_wire).
If you need to distinguish “no result” from “result is JSON null”
across the wire, change the field type to Option<Option<Value>>
and use serde_with::rust::double_option. This is a deliberately
non-default choice; do not make it without coordination.
Fields§
§id: Uuid§result: Option<Value>§error: Option<String>Implementations§
Trait Implementations§
Source§impl Clone for WsResponse
impl Clone for WsResponse
Source§fn clone(&self) -> WsResponse
fn clone(&self) -> WsResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 WsResponse
impl Debug for WsResponse
Source§impl<'de> Deserialize<'de> for WsResponse
impl<'de> Deserialize<'de> for WsResponse
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
Auto Trait Implementations§
impl Freeze for WsResponse
impl RefUnwindSafe for WsResponse
impl Send for WsResponse
impl Sync for WsResponse
impl Unpin for WsResponse
impl UnsafeUnpin for WsResponse
impl UnwindSafe for WsResponse
Blanket Implementations§
impl<T> Allocation for T
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