Struct iron::Iron [] [src]

pub struct Iron<H> {
    pub handler: H,
    pub timeouts: Timeouts,
    pub threads: usize,
}

The primary entrance point to Iron, a struct to instantiate a new server.

Iron contains the Handler which takes a Request and produces a Response.

Fields

Iron contains a Handler, which it uses to create responses for client requests.

Server timeouts.

The number of request handling threads.

Defaults to 8 * num_cpus.

Methods

impl<H: Handler> Iron<H>
[src]

Instantiate a new instance of Iron.

This will create a new Iron, the base unit of the server, using the passed in Handler.

Kick off the server process using the HTTP protocol.

Call this once to begin listening for requests on the server. This consumes the Iron instance, but does the listening on another task, so is not blocking.

The thread returns a guard that will automatically join with the parent once it is dropped, blocking until this happens.

Kick off the server process using the HTTPS protocol.

Call this once to begin listening for requests on the server. This consumes the Iron instance, but does the listening on another task, so is not blocking.

The thread returns a guard that will automatically join with the parent once it is dropped, blocking until this happens.

Kick off a server process on an arbitrary Listener.

Most use cases may call http and https methods instead of this.