@@ -15,38 +15,39 @@ bundled with your application, or downloaded on demand.
1515### Asynchronous API
1616
1717``` rust
18- use postgresql_embedded :: PostgreSQL ;
18+ use postgresql_embedded :: { PostgreSQL , Result } ;
1919
2020#[tokio:: main]
21- async fn main () {
21+ async fn main () -> Result <()> {
2222 let mut postgresql = PostgreSQL :: default ();
23- postgresql . setup (). await . unwrap () ;
24- postgresql . start (). await . unwrap () ;
23+ postgresql . setup (). await ? ;
24+ postgresql . start (). await ? ;
2525
2626 let database_name = " test" ;
27- postgresql . create_database (database_name ). await . unwrap () ;
28- postgresql . database_exists (database_name ). await . unwrap () ;
29- postgresql . drop_database (database_name ). await . unwrap () ;
27+ postgresql . create_database (database_name ). await ? ;
28+ postgresql . database_exists (database_name ). await ? ;
29+ postgresql . drop_database (database_name ). await ? ;
3030
31- postgresql . stop (). await . unwrap () ;
31+ postgresql . stop (). await ;
3232}
3333```
3434
3535### Synchronous API
3636``` rust
37+ use postgresql_embedded :: Result ;
3738use postgresql_embedded :: blocking :: PostgreSQL ;
3839
39- fn main () {
40+ fn main () -> Result <()> {
4041 let mut postgresql = PostgreSQL :: default ();
41- postgresql . setup (). unwrap () ;
42- postgresql . start (). unwrap () ;
42+ postgresql . setup ()? ;
43+ postgresql . start ()? ;
4344
4445 let database_name = " test" ;
45- postgresql . create_database (database_name ). unwrap () ;
46- postgresql . database_exists (database_name ). unwrap () ;
47- postgresql . drop_database (database_name ). unwrap () ;
46+ postgresql . create_database (database_name )? ;
47+ postgresql . database_exists (database_name )? ;
48+ postgresql . drop_database (database_name )? ;
4849
49- postgresql . stop (). unwrap ();
50+ postgresql . stop ()
5051}
5152```
5253
0 commit comments