@@ -313,6 +313,17 @@ mod content {
313313 }
314314 }
315315
316+ impl < ' a , ' de , E > de:: IntoDeserializer < ' de , E > for & ' a Content < ' de >
317+ where
318+ E : de:: Error ,
319+ {
320+ type Deserializer = ContentRefDeserializer < ' a , ' de , E > ;
321+
322+ fn into_deserializer ( self ) -> Self :: Deserializer {
323+ ContentRefDeserializer :: new ( self )
324+ }
325+ }
326+
316327 /// Used to capture data in [`Content`] from other deserializers.
317328 /// Cannot capture externally tagged enums, `i128` and `u128`.
318329 struct ContentVisitor < ' de > {
@@ -1100,8 +1111,7 @@ mod content {
11001111 V : Visitor < ' de > ,
11011112 E : de:: Error ,
11021113 {
1103- let seq = content. into_iter ( ) . map ( ContentDeserializer :: new) ;
1104- let mut seq_visitor = SeqDeserializer :: new ( seq) ;
1114+ let mut seq_visitor = SeqDeserializer :: new ( content. into_iter ( ) ) ;
11051115 let value = tri ! ( visitor. visit_seq( & mut seq_visitor) ) ;
11061116 tri ! ( seq_visitor. end( ) ) ;
11071117 Ok ( value)
@@ -1115,14 +1125,7 @@ mod content {
11151125 V : Visitor < ' de > ,
11161126 E : de:: Error ,
11171127 {
1118- fn content_deserializer_pair < ' de , E > (
1119- ( k, v) : ( Content < ' de > , Content < ' de > ) ,
1120- ) -> ( ContentDeserializer < ' de , E > , ContentDeserializer < ' de , E > ) {
1121- ( ContentDeserializer :: new ( k) , ContentDeserializer :: new ( v) )
1122- }
1123-
1124- let map = content. into_iter ( ) . map ( content_deserializer_pair) ;
1125- let mut map_visitor = MapDeserializer :: new ( map) ;
1128+ let mut map_visitor = MapDeserializer :: new ( content. into_iter ( ) ) ;
11261129 let value = tri ! ( visitor. visit_map( & mut map_visitor) ) ;
11271130 tri ! ( map_visitor. end( ) ) ;
11281131 Ok ( value)
@@ -1700,8 +1703,7 @@ mod content {
17001703 V : Visitor < ' de > ,
17011704 E : de:: Error ,
17021705 {
1703- let seq = content. iter ( ) . map ( ContentRefDeserializer :: new) ;
1704- let mut seq_visitor = SeqDeserializer :: new ( seq) ;
1706+ let mut seq_visitor = SeqDeserializer :: new ( content. iter ( ) ) ;
17051707 let value = tri ! ( visitor. visit_seq( & mut seq_visitor) ) ;
17061708 tri ! ( seq_visitor. end( ) ) ;
17071709 Ok ( value)
@@ -1715,16 +1717,10 @@ mod content {
17151717 V : Visitor < ' de > ,
17161718 E : de:: Error ,
17171719 {
1718- fn content_ref_deserializer_pair < ' a , ' de , E > (
1720+ fn content_ref_deserializer_pair < ' a , ' de > (
17191721 ( k, v) : & ' a ( Content < ' de > , Content < ' de > ) ,
1720- ) -> (
1721- ContentRefDeserializer < ' a , ' de , E > ,
1722- ContentRefDeserializer < ' a , ' de , E > ,
1723- ) {
1724- (
1725- ContentRefDeserializer :: new ( k) ,
1726- ContentRefDeserializer :: new ( v) ,
1727- )
1722+ ) -> ( & ' a Content < ' de > , & ' a Content < ' de > ) {
1723+ ( k, v)
17281724 }
17291725
17301726 let map = content. iter ( ) . map ( content_ref_deserializer_pair) ;
0 commit comments