Remove `visit_bytes` implementation from `FromStrVisitor`
This visitor is meant to deserialize strings using `FromStr` not bytes.
This commit is contained in:
parent
e6e23e9dd6
commit
c2fd5cefa4
|
@ -29,14 +29,6 @@ where
|
||||||
formatter.write_str(self.expectation)
|
formatter.write_str(self.expectation)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_bytes<E: de::Error>(self, v: &[u8]) -> Result<Self::Value, E> {
|
|
||||||
if let Ok(hex) = str::from_utf8(v) {
|
|
||||||
FromStr::from_str(hex).map_err(E::custom)
|
|
||||||
} else {
|
|
||||||
Err(E::invalid_value(de::Unexpected::Bytes(v), &self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
|
fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
|
||||||
FromStr::from_str(v).map_err(E::custom)
|
FromStr::from_str(v).map_err(E::custom)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue