Injecting a Diesel connection into an Iron middleware
问题 In writing my tests, I'd like to be able to inject a connection into the request so that I can wrap the entire test case in a transaction (even if there is more than one request in the test case). I've attempted to do this using a BeforeMiddleware which I can link in my test cases to insert a connection, as such: pub type DatabaseConnection = PooledConnection<ConnectionManager<PgConnection>>; pub struct DatabaseOverride { conn: DatabaseConnection, } impl BeforeMiddleware for DatabaseOverride