Skip to content

Commit c6c7d8f

Browse files
committed
PostgresNoticeHandler -> NoticeHandler
1 parent 975b6dc commit c6c7d8f

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl IntoConnectParams for Url {
254254
}
255255

256256
/// Trait for types that can handle Postgres notice messages
257-
pub trait PostgresNoticeHandler {
257+
pub trait NoticeHandler {
258258
/// Handle a Postgres notice message
259259
fn handle(&mut self, notice: PostgresDbError);
260260
}
@@ -264,7 +264,7 @@ pub trait PostgresNoticeHandler {
264264
/// This is the default handler used by a `PostgresConnection`.
265265
pub struct DefaultNoticeHandler;
266266

267-
impl PostgresNoticeHandler for DefaultNoticeHandler {
267+
impl NoticeHandler for DefaultNoticeHandler {
268268
fn handle(&mut self, notice: PostgresDbError) {
269269
info!("{}: {}", notice.severity, notice.message);
270270
}
@@ -349,7 +349,7 @@ pub fn cancel_query<T>(params: T, ssl: &SslMode, data: PostgresCancelData)
349349
struct InnerPostgresConnection {
350350
stream: BufferedStream<MaybeSslStream<InternalStream>>,
351351
next_stmt_id: uint,
352-
notice_handler: Box<PostgresNoticeHandler+Send>,
352+
notice_handler: Box<NoticeHandler+Send>,
353353
notifications: RingBuf<PostgresNotification>,
354354
cancel_data: PostgresCancelData,
355355
unknown_types: HashMap<Oid, String>,
@@ -507,8 +507,8 @@ impl InnerPostgresConnection {
507507
}
508508
}
509509

510-
fn set_notice_handler(&mut self, handler: Box<PostgresNoticeHandler+Send>)
511-
-> Box<PostgresNoticeHandler+Send> {
510+
fn set_notice_handler(&mut self, handler: Box<NoticeHandler+Send>)
511+
-> Box<NoticeHandler+Send> {
512512
mem::replace(&mut self.notice_handler, handler)
513513
}
514514

@@ -771,8 +771,7 @@ impl PostgresConnection {
771771
}
772772

773773
/// Sets the notice handler for the connection, returning the old handler.
774-
pub fn set_notice_handler(&self, handler: Box<PostgresNoticeHandler+Send>)
775-
-> Box<PostgresNoticeHandler+Send> {
774+
pub fn set_notice_handler(&self, handler: Box<NoticeHandler+Send>) -> Box<NoticeHandler+Send> {
776775
self.conn.borrow_mut().set_notice_handler(handler)
777776
}
778777

tests/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use openssl::ssl::{SslContext, Sslv3};
1111
use std::io::timer;
1212
use std::time::Duration;
1313

14-
use postgres::{PostgresNoticeHandler,
14+
use postgres::{NoticeHandler,
1515
PostgresNotification,
1616
PostgresConnection,
1717
GenericConnection,
@@ -542,7 +542,7 @@ fn test_custom_notice_handler() {
542542
static mut count: uint = 0;
543543
struct Handler;
544544

545-
impl PostgresNoticeHandler for Handler {
545+
impl NoticeHandler for Handler {
546546
fn handle(&mut self, notice: PostgresDbError) {
547547
assert_eq!("note", notice.message[]);
548548
unsafe { count += 1; }

0 commit comments

Comments
 (0)