File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ pub(crate) enum Host {
5353 Unix ( PathBuf ) ,
5454}
5555
56- #[ derive( Debug , Clone , PartialEq ) ]
56+ #[ derive( Clone , PartialEq ) ]
5757pub ( crate ) struct Inner {
5858 pub ( crate ) user : Option < String > ,
5959 pub ( crate ) password : Option < Vec < u8 > > ,
@@ -69,6 +69,45 @@ pub(crate) struct Inner {
6969 pub ( crate ) target_session_attrs : TargetSessionAttrs ,
7070}
7171
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+
72111/// Connection configuration.
73112///
74113/// 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