mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 23:57:57 +00:00
Merge pull request #72 from borman/bytestrings
Improved support for byte strings
This commit is contained in:
@@ -686,6 +686,16 @@ fn deserialize_field_visitor(
|
||||
{
|
||||
$body
|
||||
}
|
||||
|
||||
fn visit_bytes<E>(&mut self, value: &[u8]) -> ::std::result::Result<__Field, E>
|
||||
where E: ::serde::de::Error,
|
||||
{
|
||||
// TODO: would be better to generate a byte string literal match
|
||||
match ::std::str::from_utf8(value) {
|
||||
Ok(s) => self.visit_str(s),
|
||||
_ => Err(::serde::de::Error::syntax_error()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.visit(
|
||||
|
||||
Reference in New Issue
Block a user