(deserializer: D)
| 33 | R: Deserialize<'de> + Debug, |
| 34 | { |
| 35 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
| 36 | where |
| 37 | D: Deserializer<'de>, |
| 38 | { |
| 39 | #[derive(Deserialize, Debug)] |
| 40 | struct IdHelper { |
| 41 | id: Option<serde_json::Value>, |
| 42 | } |
| 43 | |
| 44 | let v = Value::deserialize(deserializer)?; |
| 45 | let helper = IdHelper::deserialize(&v).map_err(de::Error::custom)?; |
| 46 | match helper.id { |
| 47 | Some(id) => { |
| 48 | let r = R::deserialize(v).map_err(de::Error::custom)?; |
| 49 | Ok(JsonRpc::Request(id, r)) |
| 50 | } |
| 51 | None => { |
| 52 | let n = N::deserialize(v).map_err(de::Error::custom)?; |
| 53 | Ok(JsonRpc::Notification(n)) |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | impl<N, R> Serialize for JsonRpc<N, R> |
nothing calls this directly
no test coverage detected