Add support for serialize_bytes

Just serialize as a list of numbers.

Closes #150
This commit is contained in:
Alex Crichton 2017-02-21 06:21:00 -08:00
parent a47c66a81d
commit edf22b74a1

View file

@ -393,8 +393,9 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> {
Ok(()) Ok(())
} }
fn serialize_bytes(self, _value: &[u8]) -> Result<(), Self::Error> { fn serialize_bytes(self, value: &[u8]) -> Result<(), Self::Error> {
Err(Error::UnsupportedType) use serde::ser::Serialize;
value.serialize(self)
} }
fn serialize_none(self) -> Result<(), Self::Error> { fn serialize_none(self) -> Result<(), Self::Error> {
@ -1155,7 +1156,7 @@ impl<E: ser::Error> ser::Serializer for Categorize<E> {
} }
fn serialize_bytes(self, _: &[u8]) -> Result<Self::Ok, Self::Error> { fn serialize_bytes(self, _: &[u8]) -> Result<Self::Ok, Self::Error> {
Err(ser::Error::custom("unsupported")) Ok(Category::Array)
} }
fn serialize_none(self) -> Result<Self::Ok, Self::Error> { fn serialize_none(self) -> Result<Self::Ok, Self::Error> {