@@ -101,9 +101,10 @@ pub fn is_transactional() -> bool {
101
101
/// error.
102
102
///
103
103
/// Commits happen to the parent transaction.
104
- pub fn with_transaction < T , E > ( f : impl FnOnce ( ) -> TransactionOutcome < Result < T , E > > ) -> Result < T , E >
104
+ pub fn with_transaction < T , E , F > ( f : F ) -> Result < T , E >
105
105
where
106
106
E : From < DispatchError > ,
107
+ F : FnOnce ( ) -> TransactionOutcome < Result < T , E > > ,
107
108
{
108
109
// This needs to happen before `start_transaction` below.
109
110
// Otherwise we may rollback the increase, then decrease as the guard goes out of scope
@@ -129,7 +130,10 @@ where
129
130
/// This is mostly for backwards compatibility before there was a transactional layer limit.
130
131
/// It is recommended to only use [`with_transaction`] to avoid users from generating too many
131
132
/// transactional layers.
132
- pub fn with_transaction_unchecked < R > ( f : impl FnOnce ( ) -> TransactionOutcome < R > ) -> R {
133
+ pub fn with_transaction_unchecked < R , F > ( f : F ) -> R
134
+ where
135
+ F : FnOnce ( ) -> TransactionOutcome < R > ,
136
+ {
133
137
// This needs to happen before `start_transaction` below.
134
138
// Otherwise we may rollback the increase, then decrease as the guard goes out of scope
135
139
// and then end in some bad state.
@@ -163,9 +167,10 @@ pub fn with_transaction_unchecked<R>(f: impl FnOnce() -> TransactionOutcome<R>)
163
167
/// This is the same as `with_transaction`, but assuming that any function returning
164
168
/// an `Err` should rollback, and any function returning `Ok` should commit. This
165
169
/// provides a cleaner API to the developer who wants this behavior.
166
- pub fn with_storage_layer < T , E > ( f : impl FnOnce ( ) -> Result < T , E > ) -> Result < T , E >
170
+ pub fn with_storage_layer < T , E , F > ( f : F ) -> Result < T , E >
167
171
where
168
172
E : From < DispatchError > ,
173
+ F : FnOnce ( ) -> Result < T , E > ,
169
174
{
170
175
with_transaction ( || {
171
176
let r = f ( ) ;
@@ -181,9 +186,10 @@ where
181
186
///
182
187
/// If we are already in a storage layer, we just execute the provided closure.
183
188
/// If we are not, we execute the closure within a [`with_storage_layer`].
184
- pub fn in_storage_layer < T , E > ( f : impl FnOnce ( ) -> Result < T , E > ) -> Result < T , E >
189
+ pub fn in_storage_layer < T , E , F > ( f : F ) -> Result < T , E >
185
190
where
186
191
E : From < DispatchError > ,
192
+ F : FnOnce ( ) -> Result < T , E > ,
187
193
{
188
194
if is_transactional ( ) {
189
195
f ( )
0 commit comments