Struct aitch::servers::hyper::Server[][src]

pub struct Server<H, ReqBody> where
    H: Handler<ReqBody>,
    ReqBody: Body
{ /* fields omitted */ }

A hyper server, which can serve a handler.

This server back-end uses hyper to listen for incoming HTTP requests, call the provided Handler, and then return the response to the client.

The server uses the default tokio runtime to serve requests, which uses a separate reactor to drive I/O resources, and a thread-pool which uses those I/O resources to construct HTTP requests/responses. The provided handler (and any handlers it may call) are all run on this thread-pool.

Example

let addr = "127.0.0.1:3000".parse()?;
aitch::servers::hyper::Server::new(addr, handler)?.run()

Methods

impl<H, ReqBody> Server<H, ReqBody> where
    H: Handler<ReqBody>,
    ReqBody: Body
[src]

Creates a server which will listen on the provided SocketAddr and handle requests using the provided Handler.

Returns the address that the server is listening on.

Starts and runs the server.

Auto Trait Implementations

impl<H, ReqBody> Send for Server<H, ReqBody>

impl<H, ReqBody> !Sync for Server<H, ReqBody>