[][src]Struct hyper::server::Http

pub struct Http<B = Chunk> { /* fields omitted */ }

A configuration of the HTTP protocol.

This structure is used to create instances of Server or to spawn off tasks which handle a connection to an HTTP server. Each instance of Http can be configured with various protocol-level options such as keepalive.

Methods

impl<B: AsRef<[u8]> + 'static> Http<B>
[src]

Creates a new instance of the HTTP protocol, ready to spawn a server or start accepting connections.

Important traits for &'a mut W

Enables or disables HTTP keep-alive.

Default is true.

Important traits for &'a mut W

Set the maximum buffer size for the connection.

Important traits for &'a mut W

Aggregates flushes to better support pipelined responses.

Experimental, may be have bugs.

Default is false.

Important traits for &'a mut W

Swallow connection accept errors. Instead of passing up IO errors when the server is under heavy load the errors will be ignored. Some connection accept errors (like "connection reset") can be ignored, some (like "too many files open") may consume 100% CPU and a timout of 10ms is used in that case.

Default is false.

Bind the provided addr and return a server ready to handle connections.

This method will bind the addr provided with a new TCP listener ready to accept connections. Each connection will be processed with the new_service object provided as well, creating a new service per connection.

The returned Server contains one method, run, which is used to actually run the server.

Bind the provided addr and return a server with a shared Core.

This method allows the ability to share a Core with multiple servers.

This is method will bind the addr provided with a new TCP listener ready to accept connections. Each connection will be processed with the new_service object provided as well, creating a new service per connection.

Bind the provided stream of incoming IO objects with a NewService.

This method allows the ability to share a Core with multiple servers.

Bind a connection together with a Service.

This returns a Future that must be polled in order for HTTP to be driven on the connection.

Example

let http = Http::<hyper::Chunk>::new();
let conn = http.serve_connection(some_io, some_service);

let fut = conn
    .map(|_| ())
    .map_err(|e| eprintln!("server connection error: {}", e));

some_handle.spawn(fut);

Trait Implementations

impl<B> Clone for Http<B>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<B> Debug for Http<B>
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<B> Send for Http<B>

impl<B> Sync for Http<B>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Important traits for &'a mut W

Immutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Important traits for &'a mut W

Mutably borrows from an owned value. Read more

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more