@@ -797,19 +797,13 @@ mod content {
797797 /// Used by generated code to deserialize an internally tagged enum.
798798 ///
799799 /// Not public API.
800- pub struct TaggedContent < ' de , T > {
801- pub tag : T ,
802- pub content : Content < ' de > ,
803- }
804-
805- /// Not public API.
806- pub struct TaggedContentVisitor < ' de , T > {
800+ pub struct TaggedContentVisitor < T > {
807801 tag_name : & ' static str ,
808802 expecting : & ' static str ,
809- value : PhantomData < TaggedContent < ' de , T > > ,
803+ value : PhantomData < T > ,
810804 }
811805
812- impl < ' de , T > TaggedContentVisitor < ' de , T > {
806+ impl < T > TaggedContentVisitor < T > {
813807 /// Visitor for the content of an internally tagged enum with the given
814808 /// tag name.
815809 pub fn new ( name : & ' static str , expecting : & ' static str ) -> Self {
@@ -821,27 +815,11 @@ mod content {
821815 }
822816 }
823817
824- impl < ' de , T > DeserializeSeed < ' de > for TaggedContentVisitor < ' de , T >
825- where
826- T : Deserialize < ' de > ,
827- {
828- type Value = TaggedContent < ' de , T > ;
829-
830- fn deserialize < D > ( self , deserializer : D ) -> Result < Self :: Value , D :: Error >
831- where
832- D : Deserializer < ' de > ,
833- {
834- // Internally tagged enums are only supported in self-describing
835- // formats.
836- deserializer. deserialize_any ( self )
837- }
838- }
839-
840- impl < ' de , T > Visitor < ' de > for TaggedContentVisitor < ' de , T >
818+ impl < ' de , T > Visitor < ' de > for TaggedContentVisitor < T >
841819 where
842820 T : Deserialize < ' de > ,
843821 {
844- type Value = TaggedContent < ' de , T > ;
822+ type Value = ( T , Content < ' de > ) ;
845823
846824 fn expecting ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
847825 fmt. write_str ( self . expecting )
@@ -858,10 +836,7 @@ mod content {
858836 }
859837 } ;
860838 let rest = de:: value:: SeqAccessDeserializer :: new ( seq) ;
861- Ok ( TaggedContent {
862- tag,
863- content : try!( Content :: deserialize ( rest) ) ,
864- } )
839+ Ok ( ( tag, try!( Content :: deserialize ( rest) ) ) )
865840 }
866841
867842 fn visit_map < M > ( self , mut map : M ) -> Result < Self :: Value , M :: Error >
@@ -886,10 +861,7 @@ mod content {
886861 }
887862 match tag {
888863 None => Err ( de:: Error :: missing_field ( self . tag_name ) ) ,
889- Some ( tag) => Ok ( TaggedContent {
890- tag,
891- content : Content :: Map ( vec) ,
892- } ) ,
864+ Some ( tag) => Ok ( ( tag, Content :: Map ( vec) ) ) ,
893865 }
894866 }
895867 }
0 commit comments