Fix borrowed Cow<'_, [u8]> deserializing as str.
This changes the deserialize implementation for a borrowed Cow<[u8]> to specifically request a byte slice, rather than a borrowed string. The old behavior breaks any program which relies on data being deserialized the same way as it was serialized and uses Cow<[u8]>. In serde_json, it just wouldn't deserialize. In bincode, it deserialized normally unless the bytes were invalid UTF8. Fixes https://github.com/TyOverby/bincode/issues/231.
This commit is contained in:
parent
0d4d47c398
commit
af9996aa9a
@ -188,7 +188,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_str(CowBytesVisitor)
|
||||
deserializer.deserialize_bytes(CowBytesVisitor)
|
||||
}
|
||||
|
||||
pub mod size_hint {
|
||||
|
Loading…
x
Reference in New Issue
Block a user