33#![ warn( missing_docs) ]
44extern crate r2d2;
55extern crate postgres;
6+ extern crate collect;
67
8+ use collect:: LruCache ;
79use std:: cell:: RefCell ;
8- use std:: collections:: LruCache ;
910use std:: default:: Default ;
1011use std:: error;
1112use 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
253255impl < ' 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