0

私の質問は、さびでの逆参照参照についてです。

次のコードがあります。

#[database("pg_db")]
struct PgDbConn(diesel::PgConnection);

fn main() {
    rocket::ignite()
        .attach(PgDbConn::fairing())
        .mount("/", routes![find_one, find_all])
        .launch();
}

#[get("/<id>", format = "json")]
fn find_one(conn: PgDbConn, id: i32) -> Result<Json<Person>, NotFound<String>> {
    let one: QueryResult<Person> = person.find(id).first(&*conn); // Notice here deref & ref
    ...

私のPgDbConn構造体がどのように接続されるのか知りたいです。誰かメカニズムを詳しく教えてください。

4

1 に答える 1