Skip to content

Commit a7c144e

Browse files
committed
Update example in readme
1 parent a879843 commit a7c144e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extern crate r2d2_postgres;
1515
extern crate postgres;
1616

1717
use std::sync::Arc;
18+
use std::thread;
1819
use std::default::Default;
1920
use postgres::SslMode;
2021
use r2d2_postgres::PostgresConnectionManager;
@@ -23,12 +24,12 @@ fn main() {
2324
let config = Default::default();
2425
let manager = PostgresConnectionManager::new("postgres://postgres@localhost",
2526
SslMode::None).unwrap();
26-
let error_handler = r2d2::LoggingErrorHandler;
27+
let error_handler = Box::new(r2d2::LoggingErrorHandler);
2728
let pool = Arc::new(r2d2::Pool::new(config, manager, error_handler).unwrap());
2829

29-
for i in range(0, 10i32) {
30+
for i in 0..10i32 {
3031
let pool = pool.clone();
31-
spawn(proc() {
32+
thread::spawn(move || {
3233
let conn = pool.get().unwrap();
3334
conn.execute("INSERT INTO foo (bar) VALUES ($1)", &[&i]).unwrap();
3435
});

0 commit comments

Comments
 (0)