From c6c7d8f574f976d149a07b5a8c75c0a0dfe95160 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 1 Nov 2014 16:16:50 -0700 Subject: [PATCH] PostgresNoticeHandler -> NoticeHandler --- src/lib.rs | 13 ++++++------- tests/test.rs | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 154dbd75..d9d79e2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -254,7 +254,7 @@ impl IntoConnectParams for Url { } /// Trait for types that can handle Postgres notice messages -pub trait PostgresNoticeHandler { +pub trait NoticeHandler { /// Handle a Postgres notice message fn handle(&mut self, notice: PostgresDbError); } @@ -264,7 +264,7 @@ pub trait PostgresNoticeHandler { /// This is the default handler used by a `PostgresConnection`. pub struct DefaultNoticeHandler; -impl PostgresNoticeHandler for DefaultNoticeHandler { +impl NoticeHandler for DefaultNoticeHandler { fn handle(&mut self, notice: PostgresDbError) { info!("{}: {}", notice.severity, notice.message); } @@ -349,7 +349,7 @@ pub fn cancel_query(params: T, ssl: &SslMode, data: PostgresCancelData) struct InnerPostgresConnection { stream: BufferedStream>, next_stmt_id: uint, - notice_handler: Box, + notice_handler: Box, notifications: RingBuf, cancel_data: PostgresCancelData, unknown_types: HashMap, @@ -507,8 +507,8 @@ impl InnerPostgresConnection { } } - fn set_notice_handler(&mut self, handler: Box) - -> Box { + fn set_notice_handler(&mut self, handler: Box) + -> Box { mem::replace(&mut self.notice_handler, handler) } @@ -771,8 +771,7 @@ impl PostgresConnection { } /// Sets the notice handler for the connection, returning the old handler. - pub fn set_notice_handler(&self, handler: Box) - -> Box { + pub fn set_notice_handler(&self, handler: Box) -> Box { self.conn.borrow_mut().set_notice_handler(handler) } diff --git a/tests/test.rs b/tests/test.rs index d22d6a5f..57ae877b 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -11,7 +11,7 @@ use openssl::ssl::{SslContext, Sslv3}; use std::io::timer; use std::time::Duration; -use postgres::{PostgresNoticeHandler, +use postgres::{NoticeHandler, PostgresNotification, PostgresConnection, GenericConnection, @@ -542,7 +542,7 @@ fn test_custom_notice_handler() { static mut count: uint = 0; struct Handler; - impl PostgresNoticeHandler for Handler { + impl NoticeHandler for Handler { fn handle(&mut self, notice: PostgresDbError) { assert_eq!("note", notice.message[]); unsafe { count += 1; }