News for hackers. Stuff that matters.
Re:Show HN: Iron, a fast middleware-oriented Rust web server... by mercurial on Wednesday July 02, 2014 @11:16AM (#7977432)
Simple question. According to [1], middlewares are cloned for each request. Is there a good built-in way of accessing shared mutable data, such as a connection pool?

1: http://docs.ironframework.io/iron/trait.Middleware.html

Re:Show HN: Iron, a fast middleware-oriented Rust web server... by zzmp on Wednesday July 02, 2014 @01:19PM (#7978201)
We have a middleware for that! You can look at http://github.com/iron/persistent, which does wrap an RWLock in an Arc. It also provides a struct to make your middleware Share, so you can do similar things.

We also have session, which works on a HashMap under an Arc, although it isolates the mutable data to a session, instead of sharing it across isolated requests.

Re:Show HN: Iron, a fast middleware-oriented Rust web server... by eddyb on Wednesday July 02, 2014 @12:50PM (#7978028)
I would guess `Arc<Mutex<T>>`, `Arc<RWLock<T>>` and `Arc<SomeConcurrentContainer>` would all work (cloning them is a ref-count - the handle gets copied, not the contents).
Re:Show HN: Iron, a fast middleware-oriented Rust web server... by jonreem on Wednesday July 02, 2014 @01:18PM (#7978194)
You are looking for https://github.com/iron/persistent, which offers two utility middleware for exactly this.
Re:Show HN: Iron, a fast middleware-oriented Rust web server... by mercurial on Wednesday July 02, 2014 @01:42PM (#7978395)
Very nice, thanks.