Struct hyper::server::Builder [] [src]

pub struct Builder<I> { /* fields omitted */ }

A builder for a Server.

Methods

impl<I> Builder<I>
[src]

[src]

Start a new builder, wrapping an incoming stream and low-level options.

For a more convenient constructor, see Server::bind.

[src]

Sets whether HTTP/2 is required.

Default is false.

[src]

Consume this Builder, creating a Server.

Example

use hyper::{Body, Response, Server};
use hyper::service::service_fn_ok;

// Construct our SocketAddr to listen on...
let addr = ([127, 0, 0, 1], 3000).into();

// And a NewService to handle each connection...
let new_service = || {
    service_fn_ok(|_req| {
        Response::new(Body::from("Hello World"))
    })
};

// Then bind and serve...
let server = Server::bind(&addr)
    .serve(new_service);

// Finally, spawn `server` onto an Executor...

impl Builder<AddrIncoming>
[src]

[src]

Set whether TCP keepalive messages are enabled on accepted connections.

If None is specified, keepalive is disabled, otherwise the duration specified will be the time to remain idle before sending TCP keepalive probes.

[src]

Set the value of TCP_NODELAY option for accepted connections.

Trait Implementations

impl<I: Debug> Debug for Builder<I>
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<I> Send for Builder<I> where
    I: Send

impl<I> Sync for Builder<I> where
    I: Sync