File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ pub(crate) enum Host {
53
53
Unix ( PathBuf ) ,
54
54
}
55
55
56
- #[ derive( Debug , Clone , PartialEq ) ]
56
+ #[ derive( Clone , PartialEq ) ]
57
57
pub ( crate ) struct Inner {
58
58
pub ( crate ) user : Option < String > ,
59
59
pub ( crate ) password : Option < Vec < u8 > > ,
@@ -69,6 +69,45 @@ pub(crate) struct Inner {
69
69
pub ( crate ) target_session_attrs : TargetSessionAttrs ,
70
70
}
71
71
72
+ // Omit password from debug output
73
+ impl fmt:: Debug for Inner {
74
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
75
+ write ! (
76
+ f,
77
+ "Inner {{ \
78
+ user: {:?}, \
79
+ password: {}, \
80
+ dbname: {:?}, \
81
+ options: {:?}, \
82
+ application_name: {:?}, \
83
+ ssl_mode: {:?}, \
84
+ host: {:?}, \
85
+ port: {:?}, \
86
+ connect_timeout: {:?}, \
87
+ keepalives: {:?}, \
88
+ keepalives_idle: {:?}, \
89
+ target_session_attrs: {:?} \
90
+ }}",
91
+ self . user,
92
+ if self . password. is_some( ) {
93
+ "Some(_)"
94
+ } else {
95
+ "None"
96
+ } ,
97
+ self . dbname,
98
+ self . options,
99
+ self . application_name,
100
+ self . ssl_mode,
101
+ self . host,
102
+ self . port,
103
+ self . connect_timeout,
104
+ self . keepalives,
105
+ self . keepalives_idle,
106
+ self . target_session_attrs
107
+ )
108
+ }
109
+ }
110
+
72
111
/// Connection configuration.
73
112
///
74
113
/// Configuration can be parsed from libpq-style connection strings. These strings come in two formats:
You can’t perform that action at this time.
0 commit comments