File tree 1 file changed +12
-0
lines changed
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 {
844
844
/// Supported Postgres message format types
845
845
///
846
846
/// Using Text format in a message assumes a Postgres `SERVER_ENCODING` of `UTF8`
847
+ #[ derive( Clone , Copy , Debug ) ]
847
848
pub enum Format {
848
849
/// Text format (UTF-8)
849
850
Text ,
@@ -867,6 +868,10 @@ where
867
868
T :: accepts ( ty)
868
869
}
869
870
871
+ fn encode_format ( & self ) -> Format {
872
+ ( * self ) . encode_format ( )
873
+ }
874
+
870
875
to_sql_checked ! ( ) ;
871
876
}
872
877
@@ -886,6 +891,13 @@ impl<T: ToSql> ToSql for Option<T> {
886
891
<T as ToSql >:: accepts ( ty)
887
892
}
888
893
894
+ fn encode_format ( & self ) -> Format {
895
+ match self {
896
+ Some ( ref val) => val. encode_format ( ) ,
897
+ None => Format :: Binary ,
898
+ }
899
+ }
900
+
889
901
to_sql_checked ! ( ) ;
890
902
}
891
903
You can’t perform that action at this time.
0 commit comments