mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-10-22 03:36:17 +00:00
Merge pull request #72 from borman/bytestrings
Improved support for byte strings
This commit is contained in:
commit
adae2bd3c5
5 files changed
+128
-6
No files matched your search
@@ -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