File tree Expand file tree Collapse file tree 3 files changed +8
-13
lines changed Expand file tree Collapse file tree 3 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,6 @@ name = "test"
1818path = " tests/test.rs"
1919
2020[dependencies ]
21- r2d2 = " 0.7 "
21+ r2d2 = " 0.8 "
2222postgres = " 0.15"
2323postgres-shared = " 0.4"
Original file line number Diff line number Diff line change @@ -27,16 +27,14 @@ pub enum TlsMode {
2727/// ```rust,no_run
2828/// extern crate r2d2;
2929/// extern crate r2d2_postgres;
30- /// extern crate postgres;
3130///
3231/// use std::thread;
3332/// use r2d2_postgres::{TlsMode, PostgresConnectionManager};
3433///
3534/// fn main() {
36- /// let config = r2d2::Config::default();
3735/// let manager = PostgresConnectionManager::new("postgres://postgres@localhost",
3836/// TlsMode::None).unwrap();
39- /// let pool = r2d2::Pool::new(config, manager).unwrap();
37+ /// let pool = r2d2::Pool::new(manager).unwrap();
4038///
4139/// for i in 0..10i32 {
4240/// let pool = pool.clone();
@@ -63,7 +61,7 @@ impl PostgresConnectionManager {
6361 -> Result < PostgresConnectionManager >
6462 where T : IntoConnectParams
6563 {
66- // fixme we shouldn't be using this private constructor :(
64+ // FIXME we shouldn't be using this private constructor :(
6765 let params = params. into_connect_params ( ) . map_err ( postgres_shared:: error:: connect) ?;
6866
6967 Ok ( PostgresConnectionManager {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ extern crate postgres;
22extern crate r2d2;
33extern crate r2d2_postgres;
44
5- use std:: sync:: Arc ;
65use std:: sync:: mpsc;
76use std:: thread;
87
@@ -13,8 +12,7 @@ fn test_basic() {
1312 let manager =
1413 PostgresConnectionManager :: new ( "postgres://postgres:password@localhost" , TlsMode :: None )
1514 . unwrap ( ) ;
16- let config = r2d2:: Config :: builder ( ) . pool_size ( 2 ) . build ( ) ;
17- let pool = Arc :: new ( r2d2:: Pool :: new ( config, manager) . unwrap ( ) ) ;
15+ let pool = r2d2:: Pool :: builder ( ) . max_size ( 2 ) . build ( manager) . unwrap ( ) ;
1816
1917 let ( s1, r1) = mpsc:: channel ( ) ;
2018 let ( s2, r2) = mpsc:: channel ( ) ;
@@ -46,11 +44,10 @@ fn test_is_valid() {
4644 let manager =
4745 PostgresConnectionManager :: new ( "postgres://postgres:password@localhost" , TlsMode :: None )
4846 . unwrap ( ) ;
49- let config = r2d2:: Config :: builder ( )
50- . pool_size ( 1 )
51- . test_on_check_out ( true )
52- . build ( ) ;
53- let pool = r2d2:: Pool :: new ( config, manager) . unwrap ( ) ;
47+ let pool = r2d2:: Pool :: builder ( )
48+ . max_size ( 1 )
49+ . build ( manager)
50+ . unwrap ( ) ;
5451
5552 pool. get ( ) . unwrap ( ) ;
5653}
You can’t perform that action at this time.
0 commit comments