From 4a6b46f9222cad61ceb8e9246b4cc33eb4f61f57 Mon Sep 17 00:00:00 2001 From: Sam Scott Date: Wed, 15 Feb 2017 17:43:33 +0000 Subject: Some _very_ hacky code to get nested url_encoded params working. --- src/ser/key.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/ser/key.rs') diff --git a/src/ser/key.rs b/src/ser/key.rs index 6cbbff4..a84f311 100644 --- a/src/ser/key.rs +++ b/src/ser/key.rs @@ -1,4 +1,5 @@ -use ser::Error; +use ser::{Error}; +use serde::ser::{SerializeStruct}; use ser::part::Sink; use serde::Serialize; use std::borrow::Cow; @@ -44,7 +45,6 @@ impl KeySink impl Sink for KeySink where End: for<'key> FnOnce(Key<'key>) -> Result { - type Ok = Ok; fn serialize_static_str(self, value: &'static str) @@ -74,3 +74,23 @@ impl Sink for KeySink Error::Custom("unsupported key".into()) } } + +impl SerializeStruct for KeySink +where End: for<'key> FnOnce(Key<'key>) -> Result +{ + type Ok = Ok; + type Error = Error; + + fn serialize_field(&mut self, + _key: &'static str, + _value: &T) + -> Result<(), Error> { + Err(Error::top_level()) + } + + fn end(self) -> Result { + Err(self.unsupported()) + } +} + + -- cgit v1.2.3