diff --git a/tokio-postgres/src/client.rs b/tokio-postgres/src/client.rs index 12eb60c7..8808eb38 100644 --- a/tokio-postgres/src/client.rs +++ b/tokio-postgres/src/client.rs @@ -120,6 +120,10 @@ pub(crate) struct SocketConfig { pub keepalives_idle: Duration, } +/// An asynchronous PostgreSQL client. +/// +/// The client is one half of what is returned when a connection is established. Users interact with the database +/// through this client object. pub struct Client { inner: Arc, socket_config: Option, diff --git a/tokio-postgres/src/connection.rs b/tokio-postgres/src/connection.rs index 4c8929c4..c8d55a34 100644 --- a/tokio-postgres/src/connection.rs +++ b/tokio-postgres/src/connection.rs @@ -76,11 +76,6 @@ where } } - /// Returns the value of a runtime parameter for this connection. - pub fn parameter(&self, name: &str) -> Option<&str> { - self.parameters.get(name).map(|s| &**s) - } - fn poll_response( &mut self, cx: &mut Context<'_>, @@ -291,6 +286,15 @@ where } } + /// Returns the value of a runtime parameter for this connection. + pub fn parameter(&self, name: &str) -> Option<&str> { + self.parameters.get(name).map(|s| &**s) + } + + /// Polls for asynchronous messages from the server. + /// + /// The server can send notices as well as notifications asynchronously to the client. Applications that wish to + /// examine those messages should use this method to drive the connection rather than its `Future` implementation. pub fn poll_message( &mut self, cx: &mut Context<'_>, @@ -319,7 +323,7 @@ where type Output = Result<(), Error>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - while let Some(_) = ready!(Pin::as_mut(&mut self).poll_message(cx)?) {} + while let Some(_) = ready!(self.poll_message(cx)?) {} Poll::Ready(Ok(())) } } diff --git a/tokio-postgres/src/statement.rs b/tokio-postgres/src/statement.rs index 09a7274f..52028bb2 100644 --- a/tokio-postgres/src/statement.rs +++ b/tokio-postgres/src/statement.rs @@ -23,6 +23,9 @@ impl Drop for StatementInner { } } +/// A prepared statement. +/// +/// Prepared statements can only be used with the connection that created them. #[derive(Clone)] pub struct Statement(Arc); @@ -56,6 +59,7 @@ impl Statement { } } +/// Information about a column of a query. #[derive(Debug)] pub struct Column { name: String,