Skip to content

Commit

Permalink
Merge pull request #27 from ekanna/master
Browse files Browse the repository at this point in the history
Fix for Usage code in README.md
  • Loading branch information
abs0luty authored Dec 12, 2023
2 parents 3e59c73 + fb9052a commit 13a9741
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Asynchronous handle for rusqlite library.
# Usage

```rust
use rusqlite::{params, Result};
use tokio_rusqlite::Connection;
use tokio_rusqlite::{params, Connection, Result};

#[derive(Debug)]
struct Person {
Expand All @@ -34,11 +33,12 @@ async fn main() -> Result<()> {
[],
)?;

let steven = Person {
id: 1,
name: "Steven".to_string(),
data: None,
};
let steven =
Person {
id: 1,
name: "Steven".to_string(),
data: None,
};

conn.execute(
"INSERT INTO person (name, data) VALUES (?1, ?2)",
Expand All @@ -54,16 +54,17 @@ async fn main() -> Result<()> {
data: row.get(2)?,
})
})?
.collect::<Result<Vec<Person>, rusqlite::Error>>()?;
.collect::<std::result::Result<Vec<Person>, rusqlite::Error>>()?;

Ok::<_, rusqlite::Error>(people)
Ok(people)
})
.await?;

for person in people {
println!("Found person {:?}", person);
println!("Found person {person:?}");
}

conn.close().await?;
Ok(())
}
```
Expand Down

0 comments on commit 13a9741

Please sign in to comment.