[][src]Struct iron::Iron

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

handler: H

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

timeouts: Timeouts

Server timeouts.

threads: usize

The number of request handling threads.

Defaults to 8 * num_cpus.

Methods

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

pub fn new(handler: H) -> 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.

pub fn http<A>(self, addr: A) -> HttpResult<Listening> where
    A: ToSocketAddrs
[src]

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.

pub fn https<A, S>(self, addr: A, ssl: S) -> HttpResult<Listening> where
    A: ToSocketAddrs,
    S: 'static + SslServer + Send + Clone
[src]

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.

pub fn listen<L>(self, listener: L, protocol: Protocol) -> HttpResult<Listening> where
    L: 'static + NetworkListener + Send
[src]

Kick off a server process on an arbitrary Listener.

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

Auto Trait Implementations

impl<H> Sync for Iron<H> where
    H: Sync

impl<H> Unpin for Iron<H> where
    H: Unpin

impl<H> Send for Iron<H> where
    H: Send

impl<H> UnwindSafe for Iron<H> where
    H: UnwindSafe

impl<H> RefUnwindSafe for Iron<H> where
    H: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> UnsafeAny for T where
    T: Any