From bc8197c884e7a5dae25b6aedb02eac98145bee92 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 31 Jan 2017 10:42:51 +0100 Subject: Update serde to 0.9.3 and use serde::ser::Impossible --- src/ser/pair.rs | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'src/ser/pair.rs') diff --git a/src/ser/pair.rs b/src/ser/pair.rs index 743b3dd..6815647 100644 --- a/src/ser/pair.rs +++ b/src/ser/pair.rs @@ -2,7 +2,6 @@ use ser::Error; use ser::key::KeySink; use ser::part::PartSerializer; use ser::value::ValueSink; -use ser::void::VoidSerializer; use serde::ser; use std::borrow::Cow; use std::mem; @@ -30,13 +29,13 @@ impl<'target, Target> ser::Serializer for PairSerializer<'target, Target> { type Ok = (); type Error = Error; - type SerializeSeq = VoidSerializer<()>; + type SerializeSeq = ser::Impossible<(), Error>; type SerializeTuple = Self; - type SerializeTupleStruct = VoidSerializer<()>; - type SerializeTupleVariant = VoidSerializer<()>; - type SerializeMap = VoidSerializer<()>; - type SerializeStruct = VoidSerializer<()>; - type SerializeStructVariant = VoidSerializer<()>; + type SerializeTupleStruct = ser::Impossible<(), Error>; + type SerializeTupleVariant = ser::Impossible<(), Error>; + type SerializeMap = ser::Impossible<(), Error>; + type SerializeStruct = ser::Impossible<(), Error>; + type SerializeStructVariant = ser::Impossible<(), Error>; fn serialize_bool(self, _v: bool) -> Result<(), Error> { Err(Error::unsupported_pair()) @@ -140,13 +139,13 @@ impl<'target, Target> ser::Serializer for PairSerializer<'target, Target> fn serialize_seq(self, _len: Option) - -> Result, Error> { + -> Result { Err(Error::unsupported_pair()) } fn serialize_seq_fixed_size(self, _len: usize) - -> Result, Error> { + -> Result { Err(Error::unsupported_pair()) } @@ -161,38 +160,40 @@ impl<'target, Target> ser::Serializer for PairSerializer<'target, Target> fn serialize_tuple_struct(self, _name: &'static str, _len: usize) - -> Result, Error> { + -> Result { Err(Error::unsupported_pair()) } - fn serialize_tuple_variant(self, - _name: &'static str, - _variant_index: usize, - _variant: &'static str, - _len: usize) - -> Result, Error> { + fn serialize_tuple_variant + (self, + _name: &'static str, + _variant_index: usize, + _variant: &'static str, + _len: usize) + -> Result { Err(Error::unsupported_pair()) } fn serialize_map(self, _len: Option) - -> Result, Error> { + -> Result { Err(Error::unsupported_pair()) } fn serialize_struct(self, _name: &'static str, _len: usize) - -> Result, Error> { + -> Result { Err(Error::unsupported_pair()) } - fn serialize_struct_variant(self, - _name: &'static str, - _variant_index: usize, - _variant: &'static str, - _len: usize) - -> Result, Error> { + fn serialize_struct_variant + (self, + _name: &'static str, + _variant_index: usize, + _variant: &'static str, + _len: usize) + -> Result { Err(Error::unsupported_pair()) } } -- cgit v1.2.3