Iron is a extensible web framework for Rust.
Questions tagged [iron]
120 questions
11
votes
3 answers
Using rust-websocket with Iron
For a high-performance websocket server, ideally I want to reorient Iron to listen websockets instead of http(s).
Is it possible to use rust-websocket with iron, or does it not make sense to use both together?
If it is possible, how can I realize…

Lodin
- 2,028
- 2
- 18
- 29
6
votes
1 answer
How do I send a file included with include_bytes! as an Iron response?
I'm trying to send a file that I included in the binary with include_bytes! in an Iron application. I want to end up with a single file for my application and it only needs very few HTML, CSS and JS files. Here's a small test setup that I'm fiddling…

selfawaresoup
- 15,473
- 7
- 36
- 47
5
votes
0 answers
How to configure Iron to listen to a Unix Domain Socket?
I have this simple example from ironframework.io:
extern crate iron;
use iron::prelude::*;
use iron::status;
fn main() {
fn hello_world(_: &mut Request) -> IronResult {
Ok(Response::with((status::Ok, "Hello World!")))
}
…

MajidTaheri
- 3,813
- 6
- 28
- 46
5
votes
2 answers
panic! does not stop an Iron server
I thought panic! stops everything in Rust, but if I panic! in an Iron route handler function it does not stop the whole server. Instead, it just displays the panic message.
Is it the "normal" behavior of panic!?
I'm not posting my actual code…

rap-2-h
- 30,204
- 37
- 167
- 263
5
votes
1 answer
How do I read an Iron Request in both middleware and the handler?
I'm working on a small API in Rust and am not sure how to access a Request from Iron in two places.
The Authentication middleware reads the Request once for a token and the actual route tries to read it again if the path is allowed (currently there…

Cottonwoods
- 53
- 4
4
votes
3 answers
How to avoid zombie processes when running a Command?
A small Iron project calls a Command in some route and returns a Response. Here is the relevant code of the route handler function:
fn convert(req: &mut Request) -> IronResult {
// ...
// init some bindings like destination_html…

rap-2-h
- 30,204
- 37
- 167
- 263
4
votes
1 answer
How does the Iron framework apply a tuple of modifiers to Response::with?
I am looking into the Iron source code for Response::with(), trying to understand how it applies a tuple as modifiers to the response.
As I understand, a modifier is simply a builder object, taking in a reference to the current context (self) and…

Jacob Clark
- 3,317
- 5
- 32
- 61
4
votes
1 answer
What is the idiomatic alternative to static mutable data?
I'm using the Iron framework to create a simple endpoint. I have stateful, mutable data that the endpoint needs access to.
Here's some code that shows my intention:
extern crate iron;
extern crate mount;
use iron::{Iron, Request, Response,…

w.brian
- 16,296
- 14
- 69
- 118
4
votes
2 answers
Using iron framework, how to exit the listening loop?
I have a simple rest sort of skin around a large text file that I need to query interactively. It can involve a heavy compute so I used rust. I have put a simple restful skin with Iron. Note that I haven't done much with rust. This is just running…

sgldiv
- 623
- 6
- 16
3
votes
1 answer
"iron::Modifier is not implemented" while trying to set content-type on response using iron and mime
I am trying to run the examples from the book Programming Rust published by O'Reilly and I am stuck at making the following code compile successfully:
Cargo.toml
[package]
name = "gcd-online"
version = "0.1.0"
authors = ["Jignesh Gohel…

Jignesh Gohel
- 6,236
- 6
- 53
- 89
3
votes
1 answer
How can I pass around variables between handlers
I want to have a context-struct that is available in all handlers, but I am not able to get trough the compiler.
For an example, I want something like this
extern crate iron;
extern crate router;
use iron::prelude::*;
use router::Router;
use…
user2329125
3
votes
1 answer
Cannot set headers of an Iron framework Response
I am looking to set the headers of a Iron Response with the following code:
extern crate iron; // 0.3.0
extern crate hyper; // 0.8.1
use iron::prelude::*;
use iron::status;
use hyper::header::{Headers, ContentType};
use hyper::mime::{Mime,…

Jacob Clark
- 3,317
- 5
- 32
- 61
3
votes
0 answers
Laravel5 Iron.mq4 reservation_id
I'm trying to run a simple queuing system using the above tools.
I am getting the Queue to push messages to my Iron.IO dashboard. So I can see the hashed messages there. But when I run supervisor and php artisan queue:listen, I keep getting the…

Hemm K
- 469
- 7
- 21
3
votes
2 answers
Connect function that takes Write to function that takes Read
I am exploring the Iron web framework for Rust and have created a small handler that will read an image derived from the request URL, resize it and then deliver the result. From what I can tell an Iron Response can be built from a several different…

Wes
- 2,166
- 1
- 20
- 22
3
votes
1 answer
Why does this example iron code seem to block?
I'm running this hello world example code from the http://ironframework.io homepage:
extern crate iron;
use iron::prelude::*;
use iron::status;
fn main() {
fn hello_world(_: &mut Request) -> IronResult {
…

Lorin Hochstein
- 57,372
- 31
- 105
- 141