@@ -254,24 +254,46 @@ impl Config {
254254 self
255255 }
256256
257+ /// Sets the timeout applied to socket-level connection attempts.
258+ ///
259+ /// Note that hostnames can resolve to multiple IP addresses, and this timeout will apply to each address of each
260+ /// host separately. Defaults to no limit.
261+ ///
262+ /// Requires the `runtime` Cargo feature (enabled by default).
257263 #[ cfg( feature = "runtime" ) ]
258264 pub fn connect_timeout ( & mut self , connect_timeout : Duration ) -> & mut Config {
259265 Arc :: make_mut ( & mut self . 0 ) . connect_timeout = Some ( connect_timeout) ;
260266 self
261267 }
262268
269+ /// Controls the use of TCP keepalive.
270+ ///
271+ /// This is ignored for Unix domain socket connections. Defaults to `true`.
272+ ///
273+ /// Requires the `runtime` Cargo feature (enabled by default).
263274 #[ cfg( feature = "runtime" ) ]
264275 pub fn keepalives ( & mut self , keepalives : bool ) -> & mut Config {
265276 Arc :: make_mut ( & mut self . 0 ) . keepalives = keepalives;
266277 self
267278 }
268279
280+ /// Sets the amount of idle time before a keepalive packet is sent on the connection.
281+ ///
282+ /// This is ignored for Unix domain sockets, or if the `keepalives` option is disabled. Defaults to 2 hours.
283+ ///
284+ /// Requires the `runtime` Cargo feature (enabled by default).
269285 #[ cfg( feature = "runtime" ) ]
270286 pub fn keepalives_idle ( & mut self , keepalives_idle : Duration ) -> & mut Config {
271287 Arc :: make_mut ( & mut self . 0 ) . keepalives_idle = keepalives_idle;
272288 self
273289 }
274290
291+ /// Sets the requirements of the session.
292+ ///
293+ /// This can be used to connect to the primary server in a clustered database rather than one of the read-only
294+ /// secondary servers. Defaults to `Any`.
295+ ///
296+ /// Requires the `runtime` Cargo feature (enabled by default).
275297 #[ cfg( feature = "runtime" ) ]
276298 pub fn target_session_attrs (
277299 & mut self ,
@@ -364,21 +386,27 @@ impl Config {
364386 Ok ( ( ) )
365387 }
366388
367- pub fn handshake < S , T > ( & self , stream : S , tls_mode : T ) -> Handshake < S , T >
368- where
369- S : AsyncRead + AsyncWrite ,
370- T : TlsMode < S > ,
371- {
372- Handshake ( HandshakeFuture :: new ( stream, tls_mode, self . clone ( ) , None ) )
373- }
374-
389+ /// Opens a connection to a PostgreSQL database.
390+ ///
391+ /// Requires the `runtime` Cargo feature (enabled by default).
375392 #[ cfg( feature = "runtime" ) ]
376393 pub fn connect < T > ( & self , make_tls_mode : T ) -> Connect < T >
377394 where
378395 T : MakeTlsMode < Socket > ,
379396 {
380397 Connect ( ConnectFuture :: new ( make_tls_mode, Ok ( self . clone ( ) ) ) )
381398 }
399+
400+ /// Connects to a PostgreSQL database over an arbitrary stream.
401+ ///
402+ /// All of the settings other than `user`, `password`, `dbname`, `options`, and `application` name are ignored.
403+ pub fn handshake < S , T > ( & self , stream : S , tls_mode : T ) -> Handshake < S , T >
404+ where
405+ S : AsyncRead + AsyncWrite ,
406+ T : TlsMode < S > ,
407+ {
408+ Handshake ( HandshakeFuture :: new ( stream, tls_mode, self . clone ( ) , None ) )
409+ }
382410}
383411
384412impl FromStr for Config {
0 commit comments