Skip to content

Commit fb2670f

Browse files
committed
Fix for upstream changes
1 parent 854a0d3 commit fb2670f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ path = "tests/test.rs"
2020
[dependencies]
2121
r2d2 = "0.2"
2222
postgres = "0.2"
23+
collect = "~0.0"

src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
#![warn(missing_docs)]
44
extern crate r2d2;
55
extern crate postgres;
6+
extern crate collect;
67

8+
use collect::LruCache;
79
use std::cell::RefCell;
8-
use std::collections::LruCache;
910
use std::default::Default;
1011
use std::error;
1112
use std::fmt;
@@ -59,6 +60,7 @@ impl error::Error for Error {
5960
///
6061
/// use std::sync::Arc;
6162
/// use std::default::Default;
63+
/// use std::thread::Thread;
6264
/// use postgres::SslMode;
6365
/// use r2d2_postgres::PostgresPoolManager;
6466
///
@@ -71,10 +73,10 @@ impl error::Error for Error {
7173
///
7274
/// for i in range(0, 10i32) {
7375
/// let pool = pool.clone();
74-
/// spawn(move || {
76+
/// Thread::spawn(move || {
7577
/// let conn = pool.get().unwrap();
7678
/// conn.execute("INSERT INTO foo (bar) VALUES ($1)", &[&i]).unwrap();
77-
/// });
79+
/// }).detach();
7880
/// }
7981
/// }
8082
/// ```
@@ -251,7 +253,7 @@ pub struct Transaction<'a> {
251253
}
252254

253255
impl<'a> GenericConnection for Transaction<'a> {
254-
fn prepare<'a>(&'a self, query: &str) -> postgres::Result<Rc<postgres::Statement<'a>>> {
256+
fn prepare<'b>(&'b self, query: &str) -> postgres::Result<Rc<postgres::Statement<'b>>> {
255257
let query = query.into_string();
256258
let mut stmts = self.conn.get_cache().borrow_mut();
257259

@@ -262,12 +264,12 @@ impl<'a> GenericConnection for Transaction<'a> {
262264
Ok(Rc::new(try!(self.trans.prepare(query[]))))
263265
}
264266

265-
fn prepare_copy_in<'a>(&'a self, table: &str, columns: &[&str])
266-
-> postgres::Result<postgres::CopyInStatement<'a>> {
267+
fn prepare_copy_in<'b>(&'b self, table: &str, columns: &[&str])
268+
-> postgres::Result<postgres::CopyInStatement<'b>> {
267269
self.trans.prepare_copy_in(table, columns)
268270
}
269271

270-
fn transaction<'a>(&'a self) -> postgres::Result<Transaction<'a>> {
272+
fn transaction<'b>(&'b self) -> postgres::Result<Transaction<'b>> {
271273
Ok(Transaction {
272274
conn: self.conn,
273275
trans: try!(self.trans.transaction())

0 commit comments

Comments
 (0)