Use Box instead of ~
This commit is contained in:
11
src/lib.rs
11
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<MaybeSslStream<InternalStream>>,
|
||||
next_stmt_id: uint,
|
||||
notice_handler: ~PostgresNoticeHandler:Send,
|
||||
notice_handler: Box<PostgresNoticeHandler:Send>,
|
||||
notifications: RingBuf<PostgresNotification>,
|
||||
cancel_data: PostgresCancelData,
|
||||
unknown_types: HashMap<Oid, ~str>,
|
||||
@@ -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<PostgresNoticeHandler:Send>)
|
||||
-> Box<PostgresNoticeHandler:Send> {
|
||||
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<PostgresNoticeHandler:Send>)
|
||||
-> Box<PostgresNoticeHandler:Send> {
|
||||
self.conn.borrow_mut().set_notice_handler(handler)
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user