From b02e9b9a4a0a074f1de6f3b954caafafd3b3c325 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 21 Feb 2017 06:21:00 -0800 Subject: Add support for `serialize_bytes` Just serialize as a list of numbers. Closes #150 --- src/ser.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ser.rs b/src/ser.rs index 9460704..0b9308d 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -393,8 +393,9 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> { Ok(()) } - fn serialize_bytes(self, _value: &[u8]) -> Result<(), Self::Error> { - Err(Error::UnsupportedType) + fn serialize_bytes(self, value: &[u8]) -> Result<(), Self::Error> { + use serde::ser::Serialize; + value.serialize(self) } fn serialize_none(self) -> Result<(), Self::Error> { @@ -1155,7 +1156,7 @@ impl ser::Serializer for Categorize { } fn serialize_bytes(self, _: &[u8]) -> Result { - Err(ser::Error::custom("unsupported")) + Ok(Category::Array) } fn serialize_none(self) -> Result { -- cgit v1.2.3