Fix deserialize impl for RelayId.
We need to handle String, not just str, since some deserializers have to handle escapes and generate new strings. Found while writing tests; fixes #605.
This commit is contained in:
parent
ddc5b63a19
commit
ae07909a02
|
@ -284,7 +284,7 @@ impl<'de> serde::Deserialize<'de> for RelayId {
|
|||
// TODO(nickm): maybe allow bytes when dealing with non-human-readable
|
||||
// formats.
|
||||
use serde::de::Error as _;
|
||||
let s = <&str as serde::Deserialize>::deserialize(deserializer)?;
|
||||
let s = <std::borrow::Cow<'_, str> as serde::Deserialize>::deserialize(deserializer)?;
|
||||
s.parse()
|
||||
.map_err(|e: RelayIdError| D::Error::custom(e.to_string()))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue