Skip to content

Commit 03d1a5a

Browse files
committed
Fix build
1 parent e372cdc commit 03d1a5a

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

tokio-postgres/src/config.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ impl Default for Config {
144144
}
145145

146146
impl Config {
147+
/// Creates a new configuration.
147148
pub fn new() -> Config {
148149
Config(Arc::new(Inner {
149150
user: None,
@@ -166,11 +167,15 @@ impl Config {
166167
}))
167168
}
168169

170+
/// Sets the user to authenticate with.
171+
///
172+
/// Required.
169173
pub fn user(&mut self, user: &str) -> &mut Config {
170174
Arc::make_mut(&mut self.0).user = Some(user.to_string());
171175
self
172176
}
173177

178+
/// Sets the password to authenticate with.
174179
pub fn password<T>(&mut self, password: T) -> &mut Config
175180
where
176181
T: AsRef<[u8]>,
@@ -179,21 +184,32 @@ impl Config {
179184
self
180185
}
181186

187+
/// Sets the name of the database to connect to.
188+
///
189+
/// Defaults to the user.
182190
pub fn dbname(&mut self, dbname: &str) -> &mut Config {
183191
Arc::make_mut(&mut self.0).dbname = Some(dbname.to_string());
184192
self
185193
}
186194

195+
/// Sets command line options used to configure the server.
187196
pub fn options(&mut self, options: &str) -> &mut Config {
188197
Arc::make_mut(&mut self.0).options = Some(options.to_string());
189198
self
190199
}
191200

201+
/// Sets the value of the `application_name` runtime parameter.
192202
pub fn application_name(&mut self, application_name: &str) -> &mut Config {
193203
Arc::make_mut(&mut self.0).application_name = Some(application_name.to_string());
194204
self
195205
}
196206

207+
/// Adds a host to the configuration.
208+
///
209+
/// Multiple hosts can be specified by calling this method multiple times, and each will be tried in order. On Unix
210+
/// systems, a host starting with a `/` is interpreted as a path to a directory containing Unix domain sockets.
211+
///
212+
/// Requires the `runtime` Cargo feature (enabled by default).
197213
#[cfg(feature = "runtime")]
198214
pub fn host(&mut self, host: &str) -> &mut Config {
199215
#[cfg(unix)]
@@ -209,6 +225,11 @@ impl Config {
209225
self
210226
}
211227

228+
/// Adds a Unix socket host to the configuration.
229+
///
230+
/// Unlike `host`, this method allows non-UTF8 paths.
231+
///
232+
/// Requires the `runtime` Cargo feature (enabled by default) and a Unix target.
212233
#[cfg(all(feature = "runtime", unix))]
213234
pub fn host_path<T>(&mut self, host: T) -> &mut Config
214235
where
@@ -220,6 +241,13 @@ impl Config {
220241
self
221242
}
222243

244+
/// Adds a port to the configuration.
245+
///
246+
/// Multiple ports can be specified by calling this method multiple times. There must either be no ports, in which
247+
/// case the default of 5432 is used, a single port, in which it is used for all hosts, or the same number of ports
248+
/// as hosts.
249+
///
250+
/// Requires the `runtime` Cargo feature (enabled by default).
223251
#[cfg(feature = "runtime")]
224252
pub fn port(&mut self, port: u16) -> &mut Config {
225253
Arc::make_mut(&mut self.0).port.push(port);

tokio-postgres/tests/test/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn notifications() {
426426
while let Some(message) = try_ready!(connection.poll_message().map_err(|e| panic!("{}", e)))
427427
{
428428
if let AsyncMessage::Notification(notification) = message {
429-
debug!("received {}", notification.payload);
429+
debug!("received {}", notification.payload());
430430
tx.unbounded_send(notification).unwrap();
431431
}
432432
}
@@ -452,10 +452,10 @@ fn notifications() {
452452

453453
let notifications = rx.collect().wait().unwrap();
454454
assert_eq!(notifications.len(), 2);
455-
assert_eq!(notifications[0].channel, "test_notifications");
456-
assert_eq!(notifications[0].payload, "hello");
457-
assert_eq!(notifications[1].channel, "test_notifications");
458-
assert_eq!(notifications[1].payload, "world");
455+
assert_eq!(notifications[0].channel(), "test_notifications");
456+
assert_eq!(notifications[0].payload(), "hello");
457+
assert_eq!(notifications[1].channel(), "test_notifications");
458+
assert_eq!(notifications[1].payload(), "world");
459459
}
460460

461461
#[test]

0 commit comments

Comments
 (0)