File tree 1 file changed +13
-0
lines changed
postgres-shared/src/types
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 3
3
use fallible_iterator:: FallibleIterator ;
4
4
use postgres_protocol;
5
5
use postgres_protocol:: types:: { self , ArrayDimension } ;
6
+ use std:: borrow:: Cow ;
6
7
use std:: collections:: HashMap ;
7
8
use std:: error:: Error ;
8
9
use std:: fmt;
@@ -635,6 +636,18 @@ impl<'a> ToSql for &'a str {
635
636
to_sql_checked ! ( ) ;
636
637
}
637
638
639
+ impl < ' a > ToSql for Cow < ' a , str > {
640
+ fn to_sql ( & self , ty : & Type , w : & mut Vec < u8 > ) -> Result < IsNull , Box < Error + Sync + Send > > {
641
+ <& str as ToSql >:: to_sql ( & & self . as_ref ( ) , ty, w)
642
+ }
643
+
644
+ fn accepts ( ty : & Type ) -> bool {
645
+ <& str as ToSql >:: accepts ( ty)
646
+ }
647
+
648
+ to_sql_checked ! ( ) ;
649
+ }
650
+
638
651
impl ToSql for String {
639
652
fn to_sql ( & self , ty : & Type , w : & mut Vec < u8 > ) -> Result < IsNull , Box < Error + Sync + Send > > {
640
653
<& str as ToSql >:: to_sql ( & & * * self , ty, w)
You can’t perform that action at this time.
0 commit comments