Struct hyper::server::Server [-] [+] [src]

pub struct Server<'a, H: Handler, L = HttpListener> {
    // some fields omitted
}

A server can listen on a TCP socket.

Once listening, it will create a Request/Response pair for each incoming connection, and hand them to the provided handler.

Methods

impl<'a, H: Handler, L: NetworkListener> Server<'a, H, L>

fn new(handler: H) -> Server<'a, H, L>

impl<'a, H: Handler + 'static> Server<'a, H, HttpListener>

fn http(handler: H) -> Server<'a, H, HttpListener>

Creates a new server that will handle HttpStreams.

fn https(handler: H, cert: &'a Path, key: &'a Path) -> Server<'a, H, HttpListener>

Creates a new server that will handler HttpStreamss using a TLS connection.

impl<'a, H: Handler + 'static> Server<'a, H, HttpListener>

fn listen_threads(self, ip: IpAddr, port: u16, threads: usize) -> HttpResult<Listening>

Binds to a socket, and starts handling connections using a task pool.

fn listen(self, ip: IpAddr, port: u16) -> HttpResult<Listening>

Binds to a socket and starts handling connections.

impl<'a, H: Handler + 'static, L: NetworkListener<Stream=S> + Send + 'static, S: NetworkStream + Clone + Send> Server<'a, H, L>

fn with_listener(self, listener: L, threads: usize) -> HttpResult<Listening>

Creates a new server that will handle HttpStreams.