iron/iron — pull request #252 by reem (2014-12-27 06:47:48+00:00)
Title: Shorten Modifier syntax with `with`

Modifiers are more flexible than the custom constructors
we used to have, but came at the cost of more verbose
initialization, see:

Before: `Response::with(status::Ok, "Hello World!")`
After: `Response::new().set(status::Ok).set("Hello World!")`

But by implementing `Modifier` for tuples of `Modifier`
and a new `Response::with` constructor which pre-applies a
modifier we can recover this brevity:

Now: `Response::with((status::Ok, "Hello World!"))`

Though slightly longer due to the tuple construction, this is
a huge improvement over the original `with` since it is *far*
more flexible, for instance:

- `Response::with(status::NotFound)`
- `Response::with((status::Ok, Path::new("some_file")))`
- `Response::with((status::Ok, json::encode(data), json_mime_type))`

all work out of the box.