Skip to content

Commit

Permalink
Bring example code up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Nov 15, 2020
1 parent dff8389 commit 4c72732
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,11 @@ Backend | Adapter Crate
[tokio-postgres](https://github.com/sfackler/rust-postgres) | [bb8-postgres](https://crates.io/crates/bb8-postgres)
[redis](https://github.com/mitsuhiko/redis-rs) | [bb8-redis](https://crates.io/crates/bb8-redis)



## Example

Using an imaginary "foodb" database.

```rust
use std::thread;

extern crate bb8;
extern crate bb8_foodb;

fn main() {
let manager = bb8_foodb::FooConnectionManager::new("localhost:1234");
let pool = bb8::Pool::builder()
Expand All @@ -42,8 +35,8 @@ fn main() {

for _ in 0..20 {
let pool = pool.clone();
thread::spawn(move || {
let conn = pool.get().unwrap();
tokio::spawn(move || {
let conn = pool.get().await.unwrap();
// use the connection
// it will be returned to the pool when it falls out of scope.
})
Expand Down
3 changes: 0 additions & 3 deletions bb8/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
//! Using an imaginary "foodb" database.
//!
//! ```ignore
//! use bb8;
//! use bb8_foodb;
//!
//! #[tokio::main]
//! async fn main() {
//! let manager = bb8_foodb::FooConnectionManager::new("localhost:1234");
Expand Down

0 comments on commit 4c72732

Please sign in to comment.