diff options
author | Sam Scott <sam.scott89@gmail.com> | 2017-02-15 17:43:33 +0000 |
---|---|---|
committer | Sam Scott <sam.scott89@gmail.com> | 2017-02-15 17:43:50 +0000 |
commit | 4a6b46f9222cad61ceb8e9246b4cc33eb4f61f57 (patch) | |
tree | 735a7cc371bcf6025eaecfb1acf8dec317d0e928 /src/ser/part.rs | |
parent | c0457909e41735b17b66e11a1d2cf1660f6b3c6d (diff) |
Some _very_ hacky code to get nested url_encoded params working.
Diffstat (limited to 'src/ser/part.rs')
-rw-r--r-- | src/ser/part.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ser/part.rs b/src/ser/part.rs index 42653c0..d2ade0a 100644 --- a/src/ser/part.rs +++ b/src/ser/part.rs @@ -14,8 +14,8 @@ impl<S: Sink> PartSerializer<S> { } } -pub trait Sink: Sized { - type Ok; +pub trait Sink: Sized + ser::SerializeStruct { + // type Ok; fn serialize_static_str(self, value: &'static str) @@ -33,7 +33,7 @@ pub trait Sink: Sized { fn unsupported(self) -> Error; } -impl<S: Sink> ser::Serializer for PartSerializer<S> { +impl<S: Sink<Error=Error>> ser::Serializer for PartSerializer<S> { type Ok = S::Ok; type Error = Error; type SerializeSeq = ser::Impossible<S::Ok, Error>; @@ -41,7 +41,7 @@ impl<S: Sink> ser::Serializer for PartSerializer<S> { type SerializeTupleStruct = ser::Impossible<S::Ok, Error>; type SerializeTupleVariant = ser::Impossible<S::Ok, Error>; type SerializeMap = ser::Impossible<S::Ok, Error>; - type SerializeStruct = ser::Impossible<S::Ok, Error>; + type SerializeStruct = S; type SerializeStructVariant = ser::Impossible<S::Ok, Error>; fn serialize_bool(self, v: bool) -> Result<S::Ok, Error> { @@ -193,7 +193,9 @@ impl<S: Sink> ser::Serializer for PartSerializer<S> { _name: &'static str, _len: usize) -> Result<Self::SerializeStruct, Error> { - Err(self.sink.unsupported()) + // Err(self.sink.unsupported()) + Ok(self.sink) + } fn serialize_struct_variant @@ -207,7 +209,7 @@ impl<S: Sink> ser::Serializer for PartSerializer<S> { } } -impl<S: Sink> PartSerializer<S> { +impl<S: Sink<Error=Error>> PartSerializer<S> { fn serialize_integer<I>(self, value: I) -> Result<S::Ok, Error> where I: itoa::Integer, { |