File tree Expand file tree Collapse file tree
postgres-shared/src/types Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33use fallible_iterator:: FallibleIterator ;
44use postgres_protocol;
55use postgres_protocol:: types:: { self , ArrayDimension } ;
6+ use std:: borrow:: Cow ;
67use std:: collections:: HashMap ;
78use std:: error:: Error ;
89use std:: fmt;
@@ -635,6 +636,18 @@ impl<'a> ToSql for &'a str {
635636 to_sql_checked ! ( ) ;
636637}
637638
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+
638651impl ToSql for String {
639652 fn to_sql ( & self , ty : & Type , w : & mut Vec < u8 > ) -> Result < IsNull , Box < Error + Sync + Send > > {
640653 <& str as ToSql >:: to_sql ( & & * * self , ty, w)
You can’t perform that action at this time.
0 commit comments