Struct zhelezo::Iron
[−]
[src]
pub struct Iron<H> { pub handler: Arc<H>, pub timeouts: Timeouts, pub pool: CpuPool, pub protocol: Protocol, pub local_address: Option<SocketAddr>, }
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: Arc<H>
Iron contains a Handler
, which it uses to create responses for client
requests.
timeouts: Timeouts
Server timeouts.
pool: CpuPool
Cpu pool to run synchronus requests on.
Defaults to num_cpus
. Note that reading/writing to the client is
handled asyncronusly in a single thread.
protocol: Protocol
Protocol of the incoming requests
This is automatically set by the http
and https
functions, but
can be set if you are manually constructing the hyper http
instance.
local_address: Option<SocketAddr>
Default host address to use when none is provided
When set, this provides a default host for any requests that don't provide one. When unset, any request without a host specified will fail.
Methods
impl<H: Handler> Iron<H>
[src]
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
.
fn http<A>(self, addr: A) where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
Kick off the server process using the HTTP protocol.
Call this once to begin listening for requests on the server.
Trait Implementations
impl<H: Handler> NewService for Iron<H>
[src]
type Request = HttpRequest
Requests handled by the service
type Response = HttpResponse
Responses given by the service
type Error = Error
Errors produced by the service
type Instance = IronHandler<H>
The Service
value created by this factory
fn new_service(&self) -> Result<Self::Instance, Error>
[src]
Create and return a new service value.