Quantcast
Channel: Injecting a Diesel connection into an Iron middleware - Stack Overflow
Browsing all 3 articles
Browse latest View live

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 Article


Answer 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 Article

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...

View Article
Browsing all 3 articles
Browse latest View live