@@ -772,17 +772,12 @@ pub trait ToSql: fmt::Debug {
772
772
773
773
/// Specify the encode format
774
774
fn encode_format ( & self ) -> i16 { 1 }
775
-
776
- /// return string representation
777
- fn as_string ( & self ) -> String {
778
- panic ! ( "as_string not implemented for {:?}" , self )
779
- }
780
775
}
781
776
782
777
783
778
/// A Wrapper type used for sending query parameters encoded as unknown.
784
779
#[ derive( Debug ) ]
785
- pub struct Unknown < ' a > ( pub & ' a ( dyn ToSql + Sync ) ) ;
780
+ pub struct Unknown < ' a > ( pub & ' a str ) ;
786
781
787
782
impl ToSql for Unknown < ' _ > {
788
783
fn to_sql (
@@ -792,7 +787,7 @@ impl ToSql for Unknown<'_> {
792
787
) -> Result < IsNull , Box < dyn Error + Sync + Send > > {
793
788
match * self {
794
789
Unknown ( val) => {
795
- types:: text_to_sql ( & val. as_string ( ) , out) ;
790
+ types:: text_to_sql ( val, out) ;
796
791
Ok ( IsNull :: No )
797
792
}
798
793
}
@@ -939,7 +934,7 @@ impl<'a> ToSql for &'a str {
939
934
_ => false ,
940
935
}
941
936
}
942
- fn as_string ( & self ) -> String { self . to_string ( ) }
937
+
943
938
to_sql_checked ! ( ) ;
944
939
}
945
940
@@ -963,7 +958,7 @@ impl ToSql for String {
963
958
fn accepts ( ty : & Type ) -> bool {
964
959
<& str as ToSql >:: accepts ( ty)
965
960
}
966
- fn as_string ( & self ) -> String { self . clone ( ) }
961
+
967
962
to_sql_checked ! ( ) ;
968
963
}
969
964
@@ -978,10 +973,6 @@ macro_rules! simple_to {
978
973
Ok ( IsNull :: No )
979
974
}
980
975
981
- fn as_string( & self ) -> String {
982
- format!( "{}" , & self )
983
- }
984
-
985
976
accepts!( $( $expected) ,+) ;
986
977
987
978
to_sql_checked!( ) ;
0 commit comments