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

pub struct Server<S, B> where
    B: Stream<Error = Error>,
    B::Item: AsRef<[u8]>, 
{ /* fields omitted */ }

An instance of a server created through Http::bind.

This server is intended as a convenience for creating a TCP listener on an address and then serving TCP connections accepted with the service provided.

Methods

impl<S, B> Server<S, B> where
    S: NewService<Request = Request, Response = Response<B>, Error = Error> + 'static,
    B: Stream<Error = Error> + 'static,
    B::Item: AsRef<[u8]>, 
[src]

[src]

Returns the local address that this server is bound to.

[src]

Returns a handle to the underlying event loop that this server will be running on.

Important traits for &'a mut R
[src]

Configure the amount of time this server will wait for a "graceful shutdown".

This is the amount of time after the shutdown signal is received the server will wait for all pending connections to finish. If the timeout elapses then the server will be forcibly shut down.

This defaults to 1s.

[src]

Execute this server infinitely.

This method does not currently return, but it will return an error if one occurs.

[src]

Execute this server until the given future, shutdown_signal, resolves.

This method, like run above, is used to execute this HTTP server. The difference with run, however, is that this method allows for shutdown in a graceful fashion. The future provided is interpreted as a signal to shut down the server when it resolves.

This method will block the current thread executing the HTTP server. When the shutdown_signal has resolved then the TCP listener will be unbound (dropped). The thread will continue to block for a maximum of shutdown_timeout time waiting for active connections to shut down. Once the shutdown_timeout elapses or all active connections are cleaned out then this method will return.

impl<S, B> Server<S, B> where
    S: NewService<Request = Request, Response = Response<B>, Error = Error> + Send + Sync + 'static,
    B: Stream<Error = Error> + 'static,
    B::Item: AsRef<[u8]>, 
[src]

[src]

Run the server on multiple threads.

Trait Implementations

impl<S: Debug, B: Stream<Error = Error>> Debug for Server<S, B> where
    B::Item: AsRef<[u8]>, 
[src]

[src]

Formats the value using the given formatter. Read more