File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -844,6 +844,7 @@ pub trait ToSql: fmt::Debug {
844844/// Supported Postgres message format types
845845///
846846/// Using Text format in a message assumes a Postgres `SERVER_ENCODING` of `UTF8`
847+ #[ derive( Clone , Copy , Debug ) ]
847848pub enum Format {
848849 /// Text format (UTF-8)
849850 Text ,
@@ -867,6 +868,10 @@ where
867868 T :: accepts ( ty)
868869 }
869870
871+ fn encode_format ( & self ) -> Format {
872+ ( * self ) . encode_format ( )
873+ }
874+
870875 to_sql_checked ! ( ) ;
871876}
872877
@@ -886,6 +891,13 @@ impl<T: ToSql> ToSql for Option<T> {
886891 <T as ToSql >:: accepts ( ty)
887892 }
888893
894+ fn encode_format ( & self ) -> Format {
895+ match self {
896+ Some ( ref val) => val. encode_format ( ) ,
897+ None => Format :: Binary ,
898+ }
899+ }
900+
889901 to_sql_checked ! ( ) ;
890902}
891903
You can’t perform that action at this time.
0 commit comments