Skip to content

Commit

Permalink
Add 86800
Browse files Browse the repository at this point in the history
  • Loading branch information
fanninpm committed Jul 4, 2021
1 parent 4bab5fa commit 71caf81
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ices/86800.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#![feature(min_type_alias_impl_trait)]
use std::future::Future;

struct Connection {
}

trait Transaction {
}

struct TestTransaction<'conn> {
conn: &'conn Connection
}

impl<'conn> Transaction for TestTransaction<'conn> {
}

struct Context {
}

type TransactionResult<O> = Result<O, ()>;

type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;

fn execute_transaction_fut<'f, F, O>(f: F) -> impl FnOnce(&mut dyn Transaction) -> TransactionFuture<O>
where
F: FnOnce(&mut dyn Transaction) -> TransactionFuture<O> + 'f
{
f
}

impl Context {
async fn do_transaction<O>(
&self, f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<O>
) -> TransactionResult<O>
{
let mut conn = Connection {};
let mut transaction = TestTransaction { conn: &mut conn };
f(&mut transaction).await
}
}

0 comments on commit 71caf81

Please sign in to comment.