↧
Answer by sgrif for Injecting a Diesel connection into an Iron middleware
This answer will certainly solve the problem, but it's not optimal. As mentioned, you can't share a single connection as it's not thread safe. However, while wrapping it in a Mutex makes it...
View ArticleAnswer by Shepmaster for Injecting a Diesel connection into an Iron middleware
Since there isn't enough code provided for me to reproduce your issue, I've made this:use std::cell::Cell;trait Middleware: Sync {}struct Unsharable(Cell<bool>);impl Middleware for Unsharable...
View ArticleInjecting 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...
View Article
More Pages to Explore .....