@@ -5,6 +5,7 @@ use crate::errors::serialize::DeError;
55use crate :: se:: content:: ContentSerializer ;
66use crate :: se:: key:: QNameSerializer ;
77use crate :: se:: simple_type:: { QuoteTarget , SimpleSeq , SimpleTypeSerializer } ;
8+ use crate :: se:: text:: TextSerializer ;
89use crate :: se:: { Indent , XmlName } ;
910use serde:: ser:: {
1011 Impossible , Serialize , SerializeMap , SerializeSeq , SerializeStruct , SerializeStructVariant ,
@@ -438,7 +439,7 @@ impl<'w, 'k, W: Write> Struct<'w, 'k, W> {
438439 } ;
439440
440441 if key == TEXT_KEY {
441- value. serialize ( ser. into_simple_type_serializer ( ) ) ?;
442+ value. serialize ( TextSerializer ( ser. into_simple_type_serializer ( ) ) ) ?;
442443 } else if key == VALUE_KEY {
443444 value. serialize ( ser) ?;
444445 } else {
@@ -821,7 +822,7 @@ mod tests {
821822 content: Enum :: Newtype ( 42 ) ,
822823 after: "answer" ,
823824 }
824- => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as an attribute or text content value" ) ) ;
825+ => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as text content value" ) ) ;
825826
826827 // Sequences are serialized separated by spaces, all spaces inside are escaped
827828 text ! ( seq: vec![ 1 , 2 , 3 ] => "1 2 3" ) ;
@@ -838,7 +839,7 @@ mod tests {
838839 content: Enum :: Tuple ( "first" , 42 ) ,
839840 after: "answer" ,
840841 }
841- => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as an attribute or text content value" ) ) ;
842+ => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as text content value" ) ) ;
842843
843844 // Complex types cannot be serialized in `$text` field
844845 err ! ( map:
@@ -847,21 +848,21 @@ mod tests {
847848 content: BTreeMap :: from( [ ( "_1" , 2 ) , ( "_3" , 4 ) ] ) ,
848849 after: "answer" ,
849850 }
850- => Unsupported ( "cannot serialize map as an attribute or text content value" ) ) ;
851+ => Unsupported ( "cannot serialize map as text content value" ) ) ;
851852 err ! ( struct_:
852853 Text {
853854 before: "answer" ,
854855 content: Struct { key: "answer" , val: ( 42 , 42 ) } ,
855856 after: "answer" ,
856857 }
857- => Unsupported ( "cannot serialize struct `Struct` as an attribute or text content value" ) ) ;
858+ => Unsupported ( "cannot serialize struct `Struct` as text content value" ) ) ;
858859 err ! ( enum_struct:
859860 Text {
860861 before: "answer" ,
861862 content: Enum :: Struct { key: "answer" , val: ( 42 , 42 ) } ,
862863 after: "answer" ,
863864 }
864- => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as an attribute or text content value" ) ) ;
865+ => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as text content value" ) ) ;
865866 }
866867
867868 /// `$text` field inside a struct
@@ -948,7 +949,7 @@ mod tests {
948949 content: Enum :: Newtype ( 42 ) ,
949950 after: "answer" ,
950951 }
951- => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as an attribute or text content value" ) ) ;
952+ => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as text content value" ) ) ;
952953
953954 // Sequences are serialized separated by spaces, all spaces inside are escaped
954955 text ! ( seq: vec![ 1 , 2 , 3 ] => "1 2 3" ) ;
@@ -965,7 +966,7 @@ mod tests {
965966 content: Enum :: Tuple ( "first" , 42 ) ,
966967 after: "answer" ,
967968 }
968- => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as an attribute or text content value" ) ) ;
969+ => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as text content value" ) ) ;
969970
970971 // Complex types cannot be serialized in `$text` field
971972 err ! ( map:
@@ -974,21 +975,21 @@ mod tests {
974975 content: BTreeMap :: from( [ ( "_1" , 2 ) , ( "_3" , 4 ) ] ) ,
975976 after: "answer" ,
976977 }
977- => Unsupported ( "cannot serialize map as an attribute or text content value" ) ) ;
978+ => Unsupported ( "cannot serialize map as text content value" ) ) ;
978979 err ! ( struct_:
979980 Text {
980981 before: "answer" ,
981982 content: Struct { key: "answer" , val: ( 42 , 42 ) } ,
982983 after: "answer" ,
983984 }
984- => Unsupported ( "cannot serialize struct `Struct` as an attribute or text content value" ) ) ;
985+ => Unsupported ( "cannot serialize struct `Struct` as text content value" ) ) ;
985986 err ! ( enum_struct:
986987 Text {
987988 before: "answer" ,
988989 content: Enum :: Struct { key: "answer" , val: ( 42 , 42 ) } ,
989990 after: "answer" ,
990991 }
991- => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as an attribute or text content value" ) ) ;
992+ => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as text content value" ) ) ;
992993 }
993994 }
994995
@@ -1527,7 +1528,7 @@ mod tests {
15271528 content: Enum :: Newtype ( 42 ) ,
15281529 after: "answer" ,
15291530 }
1530- => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as an attribute or text content value" ) ) ;
1531+ => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as text content value" ) ) ;
15311532
15321533 // Sequences are serialized separated by spaces, all spaces inside are escaped
15331534 text ! ( seq: vec![ 1 , 2 , 3 ] => "1 2 3" ) ;
@@ -1544,7 +1545,7 @@ mod tests {
15441545 content: Enum :: Tuple ( "first" , 42 ) ,
15451546 after: "answer" ,
15461547 }
1547- => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as an attribute or text content value" ) ) ;
1548+ => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as text content value" ) ) ;
15481549
15491550 // Complex types cannot be serialized in `$text` field
15501551 err ! ( map:
@@ -1553,21 +1554,21 @@ mod tests {
15531554 content: BTreeMap :: from( [ ( "_1" , 2 ) , ( "_3" , 4 ) ] ) ,
15541555 after: "answer" ,
15551556 }
1556- => Unsupported ( "cannot serialize map as an attribute or text content value" ) ) ;
1557+ => Unsupported ( "cannot serialize map as text content value" ) ) ;
15571558 err ! ( struct_:
15581559 Text {
15591560 before: "answer" ,
15601561 content: Struct { key: "answer" , val: ( 42 , 42 ) } ,
15611562 after: "answer" ,
15621563 }
1563- => Unsupported ( "cannot serialize struct `Struct` as an attribute or text content value" ) ) ;
1564+ => Unsupported ( "cannot serialize struct `Struct` as text content value" ) ) ;
15641565 err ! ( enum_struct:
15651566 Text {
15661567 before: "answer" ,
15671568 content: Enum :: Struct { key: "answer" , val: ( 42 , 42 ) } ,
15681569 after: "answer" ,
15691570 }
1570- => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as an attribute or text content value" ) ) ;
1571+ => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as text content value" ) ) ;
15711572 }
15721573
15731574 /// `$text` field inside a struct
@@ -1666,7 +1667,7 @@ mod tests {
16661667 content: Enum :: Newtype ( 42 ) ,
16671668 after: "answer" ,
16681669 }
1669- => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as an attribute or text content value" ) ) ;
1670+ => Unsupported ( "cannot serialize enum newtype variant `Enum::Newtype` as text content value" ) ) ;
16701671
16711672 // Sequences are serialized separated by spaces, all spaces inside are escaped
16721673 text ! ( seq: vec![ 1 , 2 , 3 ] => "1 2 3" ) ;
@@ -1683,7 +1684,7 @@ mod tests {
16831684 content: Enum :: Tuple ( "first" , 42 ) ,
16841685 after: "answer" ,
16851686 }
1686- => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as an attribute or text content value" ) ) ;
1687+ => Unsupported ( "cannot serialize enum tuple variant `Enum::Tuple` as text content value" ) ) ;
16871688
16881689 // Complex types cannot be serialized in `$text` field
16891690 err ! ( map:
@@ -1692,21 +1693,21 @@ mod tests {
16921693 content: BTreeMap :: from( [ ( "_1" , 2 ) , ( "_3" , 4 ) ] ) ,
16931694 after: "answer" ,
16941695 }
1695- => Unsupported ( "cannot serialize map as an attribute or text content value" ) ) ;
1696+ => Unsupported ( "cannot serialize map as text content value" ) ) ;
16961697 err ! ( struct_:
16971698 Text {
16981699 before: "answer" ,
16991700 content: Struct { key: "answer" , val: ( 42 , 42 ) } ,
17001701 after: "answer" ,
17011702 }
1702- => Unsupported ( "cannot serialize struct `Struct` as an attribute or text content value" ) ) ;
1703+ => Unsupported ( "cannot serialize struct `Struct` as text content value" ) ) ;
17031704 err ! ( enum_struct:
17041705 Text {
17051706 before: "answer" ,
17061707 content: Enum :: Struct { key: "answer" , val: ( 42 , 42 ) } ,
17071708 after: "answer" ,
17081709 }
1709- => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as an attribute or text content value" ) ) ;
1710+ => Unsupported ( "cannot serialize enum struct variant `Enum::Struct` as text content value" ) ) ;
17101711 }
17111712 }
17121713
0 commit comments