Make impl Acquire for &'_ Pool<DB> more general

This commit is contained in:
Jonas Platte 2021-01-27 12:31:10 +01:00 committed by Ryan Leckey
parent 77238108cf
commit 1b217cfac4

View File

@ -15,7 +15,7 @@ pub trait Acquire<'c> {
fn begin(self) -> BoxFuture<'c, Result<Transaction<'c, Self::Database>, Error>>; fn begin(self) -> BoxFuture<'c, Result<Transaction<'c, Self::Database>, Error>>;
} }
impl<DB: Database> Acquire<'static> for &'_ Pool<DB> { impl<'a, DB: Database> Acquire<'a> for &'_ Pool<DB> {
type Database = DB; type Database = DB;
type Connection = PoolConnection<DB>; type Connection = PoolConnection<DB>;
@ -24,7 +24,7 @@ impl<DB: Database> Acquire<'static> for &'_ Pool<DB> {
Box::pin(self.acquire()) Box::pin(self.acquire())
} }
fn begin(self) -> BoxFuture<'static, Result<Transaction<'static, DB>, Error>> { fn begin(self) -> BoxFuture<'static, Result<Transaction<'a, DB>, Error>> {
let conn = self.acquire(); let conn = self.acquire();
Box::pin(async move { Box::pin(async move {