From ff587b3334424be1886482443e945f8c443fdfaa Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 3 May 2014 22:38:50 -0700 Subject: [PATCH] Use Box instead of ~ --- src/lib.rs | 11 ++++++----- src/test.rs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f7fa6c77..7fc208e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,6 +82,7 @@ use url::{UserInfo, Url}; use openssl::crypto::hash::{MD5, Hasher}; use openssl::ssl::{SslStream, SslContext}; use serialize::hex::ToHex; +use std::owned::Box; use std::cell::{Cell, RefCell}; use std::from_str::FromStr; use std::io::{Stream, BufferedStream, IoResult}; @@ -536,7 +537,7 @@ fn initialize_stream(params: &PostgresConnectParams, ssl: &SslMode) struct InnerPostgresConnection { stream: BufferedStream>, next_stmt_id: uint, - notice_handler: ~PostgresNoticeHandler:Send, + notice_handler: Box, notifications: RingBuf, cancel_data: PostgresCancelData, unknown_types: HashMap, @@ -694,8 +695,8 @@ impl InnerPostgresConnection { } } - fn set_notice_handler(&mut self, handler: ~PostgresNoticeHandler:Send) - -> ~PostgresNoticeHandler:Send { + fn set_notice_handler(&mut self, handler: Box) + -> Box { mem::replace(&mut self.notice_handler, handler) } @@ -896,8 +897,8 @@ impl PostgresConnection { } /// Sets the notice handler for the connection, returning the old handler. - pub fn set_notice_handler(&self, handler: ~PostgresNoticeHandler:Send) - -> ~PostgresNoticeHandler:Send { + pub fn set_notice_handler(&self, handler: Box) + -> Box { self.conn.borrow_mut().set_notice_handler(handler) } diff --git a/src/test.rs b/src/test.rs index 75b63e98..97f85fa6 100644 --- a/src/test.rs +++ b/src/test.rs @@ -829,7 +829,7 @@ fn test_custom_notice_handler() { } let conn = or_fail!(PostgresConnection::connect("postgres://postgres@localhost?client_min_messages=NOTICE", &NoSsl)); - conn.set_notice_handler(~Handler); + conn.set_notice_handler(box Handler); or_fail!(conn.execute("CREATE FUNCTION pg_temp.note() RETURNS INT AS $$ BEGIN RAISE NOTICE 'note';