diff --git a/src/lib.rs b/src/lib.rs index 6ad72729..7e1c72e0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -174,12 +174,11 @@ pub struct PostgresNotification { } /// An iterator over asynchronous notifications -pub struct PostgresNotificationIterator<'conn> { +pub struct PostgresNotifications<'conn> { priv conn: &'conn PostgresConnection } -impl<'conn > Iterator for - PostgresNotificationIterator<'conn> { +impl<'conn > Iterator for PostgresNotifications<'conn> { /// Returns the oldest pending notification or `None` if there are none. /// /// # Note @@ -649,8 +648,8 @@ impl PostgresConnection { /// Returns an iterator over asynchronous notification messages. /// /// Use the `LISTEN` command to register this connection for notifications. - pub fn notifications<'a>(&'a self) -> PostgresNotificationIterator<'a> { - PostgresNotificationIterator { + pub fn notifications<'a>(&'a self) -> PostgresNotifications<'a> { + PostgresNotifications { conn: self } } @@ -825,7 +824,7 @@ impl<'conn> PostgresTransaction<'conn> { } /// Like `PostgresConnection::notifications`. - pub fn notifications<'a>(&'a self) -> PostgresNotificationIterator<'a> { + pub fn notifications<'a>(&'a self) -> PostgresNotifications<'a> { self.conn.notifications() } diff --git a/src/pool.rs b/src/pool.rs index 43d17f64..ed1b2f1e 100644 --- a/src/pool.rs +++ b/src/pool.rs @@ -4,7 +4,7 @@ extern mod extra; use extra::arc::MutexArc; -use super::{PostgresNotificationIterator, +use super::{PostgresNotifications, PostgresCancelData, PostgresConnection, NormalPostgresStatement, @@ -147,7 +147,7 @@ impl PooledPostgresConnection { } /// Like `PostgresConnection::notifications`. - pub fn notifications<'a>(&'a self) -> PostgresNotificationIterator<'a> { + pub fn notifications<'a>(&'a self) -> PostgresNotifications<'a> { self.conn.get_ref().notifications() }