(&self, serializer: S)
| 174 | // Custom Serialize to match JSON-RPC 2.0 wire format |
| 175 | impl<R: Serialize> Serialize for JsonRpcResponse<R> { |
| 176 | fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> |
| 177 | where |
| 178 | S: serde::Serializer, |
| 179 | { |
| 180 | use serde::ser::SerializeStruct; |
| 181 | |
| 182 | let mut state = serializer.serialize_struct("JsonRpcResponse", 3)?; |
| 183 | state.serialize_field("jsonrpc", "2.0")?; |
| 184 | state.serialize_field("id", &self.id)?; |
| 185 | |
| 186 | match &self.body { |
| 187 | JsonRpcResponseBody::Success { result } => { |
| 188 | state.serialize_field("result", result)?; |
| 189 | } |
| 190 | JsonRpcResponseBody::Error { error } => { |
| 191 | state.serialize_field("error", error)?; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | state.end() |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // Custom Deserialize from JSON-RPC 2.0 wire format |
nothing calls this directly
no outgoing calls
no test coverage detected