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>
impl<'a, H: Handler + 'static> Server<'a, H, HttpListener>
fn http(handler: H) -> Server<'a, H, HttpListener>
Creates a new server that will handle HttpStream
s.
fn https(handler: H, cert: &'a Path, key: &'a Path) -> Server<'a, H, HttpListener>
Creates a new server that will handler HttpStreams
s using a TLS connection.
fn https_with_context(handler: H, ssl_context: SslContext) -> Server<'a, H, HttpListener>
Creates a new server that will handler HttpStreams
s using a TLS connection defined by an SslContext.
impl<'a, H: Handler + 'static> Server<'a, H, HttpListener>
fn listen_threads<T: ToSocketAddrs>(self, addr: T, threads: usize) -> Result<Listening>
Binds to a socket, and starts handling connections using a task pool.
fn listen<T: ToSocketAddrs>(self, addr: T) -> Result<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) -> Result<Listening>
Creates a new server that will handle HttpStream
s.