(deserializer: D)
| 212 | |
| 213 | impl<'de> Deserialize<'de> for TlvStream { |
| 214 | fn deserialize<D: Deserializer<'de>>(deserializer: D) -> std::result::Result<Self, D::Error> { |
| 215 | struct V; |
| 216 | impl<'de> serde::de::Visitor<'de> for V { |
| 217 | type Value = TlvStream; |
| 218 | fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 219 | write!(f, "a hex string representing a Lightning TLV stream") |
| 220 | } |
| 221 | fn visit_str<E: DeError>(self, s: &str) -> std::result::Result<Self::Value, E> { |
| 222 | let bytes = hex::decode(s).map_err(E::custom)?; |
| 223 | TlvStream::from_bytes_auto(&bytes).map_err(E::custom) |
| 224 | } |
| 225 | } |
| 226 | deserializer.deserialize_str(V) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | impl TryFrom<&[u8]> for TlvStream { |
nothing calls this directly
no outgoing calls
no test coverage detected