1+ use std:: borrow:: Cow ;
2+
13use crate :: decode:: Decode ;
24use crate :: encode:: { Encode , IsNull } ;
35use crate :: error:: BoxDynError ;
46use crate :: io:: MySqlBufMutExt ;
57use crate :: protocol:: text:: { ColumnFlags , ColumnType } ;
68use crate :: types:: Type ;
79use crate :: { MySql , MySqlTypeInfo , MySqlValueRef } ;
8- use std:: borrow:: Cow ;
910
1011impl Type < MySql > for str {
1112 fn type_info ( ) -> MySqlTypeInfo {
@@ -46,28 +47,12 @@ impl<'r> Decode<'r, MySql> for &'r str {
4647 }
4748}
4849
49- impl Type < MySql > for Box < str > {
50- fn type_info ( ) -> MySqlTypeInfo {
51- <& str as Type < MySql > >:: type_info ( )
52- }
53-
54- fn compatible ( ty : & MySqlTypeInfo ) -> bool {
55- <& str as Type < MySql > >:: compatible ( ty)
56- }
57- }
58-
5950impl Encode < ' _ , MySql > for Box < str > {
6051 fn encode_by_ref ( & self , buf : & mut Vec < u8 > ) -> Result < IsNull , BoxDynError > {
6152 <& str as Encode < MySql > >:: encode ( & * * self , buf)
6253 }
6354}
6455
65- impl < ' r > Decode < ' r , MySql > for Box < str > {
66- fn decode ( value : MySqlValueRef < ' r > ) -> Result < Self , BoxDynError > {
67- <& str as Decode < MySql > >:: decode ( value) . map ( Box :: from)
68- }
69- }
70-
7156impl Type < MySql > for String {
7257 fn type_info ( ) -> MySqlTypeInfo {
7358 <str as Type < MySql > >:: type_info ( )
@@ -90,16 +75,6 @@ impl Decode<'_, MySql> for String {
9075 }
9176}
9277
93- impl Type < MySql > for Cow < ' _ , str > {
94- fn type_info ( ) -> MySqlTypeInfo {
95- <& str as Type < MySql > >:: type_info ( )
96- }
97-
98- fn compatible ( ty : & MySqlTypeInfo ) -> bool {
99- <& str as Type < MySql > >:: compatible ( ty)
100- }
101- }
102-
10378impl Encode < ' _ , MySql > for Cow < ' _ , str > {
10479 fn encode_by_ref ( & self , buf : & mut Vec < u8 > ) -> Result < IsNull , BoxDynError > {
10580 match self {
@@ -108,9 +83,3 @@ impl Encode<'_, MySql> for Cow<'_, str> {
10883 }
10984 }
11085}
111-
112- impl < ' r > Decode < ' r , MySql > for Cow < ' r , str > {
113- fn decode ( value : MySqlValueRef < ' r > ) -> Result < Self , BoxDynError > {
114- value. as_str ( ) . map ( Cow :: Borrowed )
115- }
116- }
0 commit comments