Make the bounds on Connection::transaction less strict.

The provided callback doesn't need to be `'static`. It should be enough that it doesn't borrow anything from the `Connection` itself, even if it does borrow data from elsewhere.
This commit is contained in:
argv-minus-one 2021-03-24 12:47:18 -07:00 committed by Ryan Leckey
parent fc6eb6363b
commit 2123d9de2e

View File

@ -50,10 +50,10 @@ pub trait Connection: Send {
/// })).await
/// # }
/// ```
fn transaction<F, R, E>(&mut self, callback: F) -> BoxFuture<'_, Result<R, E>>
fn transaction<'a, F, R, E>(&'a mut self, callback: F) -> BoxFuture<'a, Result<R, E>>
where
for<'c> F: FnOnce(&'c mut Transaction<'_, Self::Database>) -> BoxFuture<'c, Result<R, E>>
+ 'static
+ 'a
+ Send
+ Sync,
Self: Sized,