From 31b5e882aa9058bf19534ab40ee6efa1ce6b2d73 Mon Sep 17 00:00:00 2001 From: Sam Scott Date: Fri, 10 Mar 2017 13:27:42 -0500 Subject: Cleaning up, modifying docs. --- src/ser/key.rs | 6 +++--- src/ser/mod.rs | 7 +++---- src/ser/part.rs | 2 +- src/ser/value.rs | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/ser') diff --git a/src/ser/key.rs b/src/ser/key.rs index eb7ffae..5b2ccdd 100644 --- a/src/ser/key.rs +++ b/src/ser/key.rs @@ -70,7 +70,7 @@ impl Sink for KeySink Err(self.unsupported()) } - fn unsupported(self) -> Error { + fn unsupported(&self) -> Error { Error::Custom("unsupported key".into()) } } @@ -85,7 +85,7 @@ where End: for<'key> FnOnce(Key<'key>) -> Result _key: &'static str, _value: &T) -> Result<(), Error> { - Err(Error::top_level()) + Err(self.unsupported()) } fn end(self) -> Result { @@ -102,7 +102,7 @@ where End: for<'key> FnOnce(Key<'key>) -> Result fn serialize_element(&mut self, _value: &T) -> Result<(), Error> { - Err(Error::top_level()) + Err(self.unsupported()) } fn end(self) -> Result { diff --git a/src/ser/mod.rs b/src/ser/mod.rs index 596730e..f732bb3 100644 --- a/src/ser/mod.rs +++ b/src/ser/mod.rs @@ -46,11 +46,10 @@ pub fn to_string(input: &T) -> Result { /// A serializer for the querystring format. /// -/// * Supported top-level inputs are structs, maps and sequences of pairs, -/// with or without a given length. +/// * Supported top-level inputs are structs and maps. /// -/// * Supported keys and values are integers, bytes (if convertible to strings), -/// unit structs and unit variants. +/// * Supported values are currently most primitive types, structs, maps and +/// sequences. Sequences are serialized with an incrementing key index. /// /// * Newtype structs defer to their inner values. pub struct Serializer<'output, Target: 'output + UrlEncodedTarget> { diff --git a/src/ser/part.rs b/src/ser/part.rs index d456f4b..4cf90b3 100644 --- a/src/ser/part.rs +++ b/src/ser/part.rs @@ -35,7 +35,7 @@ pub trait Sink: Sized + ser::SerializeStruct + ser::Seriali value: &T) -> Result; - fn unsupported(self) -> Error; + fn unsupported(&self) -> Error; } impl> ser::Serializer for PartSerializer { diff --git a/src/ser/value.rs b/src/ser/value.rs index 832cbf3..5ed80b9 100644 --- a/src/ser/value.rs +++ b/src/ser/value.rs @@ -55,7 +55,7 @@ impl<'key, 'target, Target> Sink<(), Error> for ValueSink<'key, 'target, Target> value.serialize(PartSerializer::new(self)) } - fn unsupported(self) -> Error { + fn unsupported(&self) -> Error { Error::Custom("unsupported value".into()) } } -- cgit v1.2.3