Skip to content

Commit 028ad8c

Browse files
committed
improve axum comment
1 parent 7292397 commit 028ad8c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

chuchi-postgres/src/db.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
//! If you wan't to use axum the best way is to make a small wrapper around
55
//! ConnOwned.
66
//!
7-
//! ```rust
7+
//! ```ignore
8+
//! use chuchi_postgres as pg;
9+
//! use pg::db::{Conn, Trans, Db};
10+
//! use axum::extract::{FromRequestParts, FromRef};
11+
//! use axum::http::request::Parts;
12+
//!
813
//! pub struct ConnOwned(pub pg::db::ConnOwned);
914
//!
1015
//! impl ConnOwned {
@@ -22,7 +27,7 @@
2227
//! S: Send + Sync,
2328
//! Db: FromRef<S>,
2429
//! {
25-
//! type Rejection = Error;
30+
//! type Rejection = MyError;
2631
//!
2732
//! async fn from_request_parts(
2833
//! _parts: &mut Parts,
@@ -32,7 +37,7 @@
3237
//! db.get()
3338
//! .await
3439
//! .map(Self)
35-
//! .map_err(|e| Error::Internal(e.to_string()))
40+
//! .map_err(|e| MyError::Internal(e.to_string()))
3641
//! }
3742
//! }
3843
//! ```

0 commit comments

Comments
 (0)