mentat/hyper/server/struct.Http.html

225 lines
44 KiB
HTML
Raw Permalink Normal View History

2018-08-22 17:04:13 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Http` struct in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Http">
<title>hyper::server::Http - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../../dark.css">
<link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<p class='location'>Struct Http</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.bind_connection">bind_connection</a><a href="#method.new">new</a><a href="#method.keep_alive">keep_alive</a><a href="#method.max_buf_size">max_buf_size</a><a href="#method.pipeline">pipeline</a><a href="#method.sleep_on_errors">sleep_on_errors</a><a href="#method.bind">bind</a><a href="#method.serve_addr_handle">serve_addr_handle</a><a href="#method.serve_incoming">serve_incoming</a><a href="#method.serve_connection">serve_connection</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-ServerProto%3CT%3E">ServerProto&lt;T&gt;</a><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a></div></div><p class='location'><a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a></p><script>window.sidebarCurrent = {name: 'Http', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../../theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a>::<wbr><a class="struct" href=''>Http</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/hyper/server/mod.rs.html#61-67' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Http&lt;B&nbsp;=&nbsp;<a class="struct" href="../../hyper/struct.Chunk.html" title="struct hyper::Chunk">Chunk</a>&gt; { /* fields omitted */ }</pre><div class='docblock'><p>A configuration of the HTTP protocol.</p>
<p>This structure is used to create instances of <code>Server</code> or to spawn off tasks
which handle a connection to an HTTP server. Each instance of <code>Http</code> can be
configured with various protocol-level options such as keepalive.</p>
</div>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;B:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt; + 'static&gt; <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/server_proto.rs.html#29-71' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.bind_connection' class="method"><span id='bind_connection.v' class='invisible'><code>pub fn <a href='#method.bind_connection' class='fnname'>bind_connection</a>&lt;S, I, Bd&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;handle: &amp;<a class="struct" href="../../tokio_core/reactor/struct.Handle.html" title="struct tokio_core::reactor::Handle">Handle</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;io: I, <br>&nbsp;&nbsp;&nbsp;&nbsp;remote_addr: <a class="enum" href="https://doc.rust-lang.org/nightly/std/net/addr/enum.SocketAddr.html" title="enum std::net::addr::SocketAddr">SocketAddr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;service: S<br>) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>&lt;Request = <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>, Response = <a class="struct" href="../../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;Bd&gt;, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../tokio_io/async_read/trait.AsyncRead.html" title="trait tokio_io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="../../tokio_io/async_write/trait.AsyncWrite.html" title="trait tokio_io::async_write::AsyncWrite">AsyncWrite</a> + 'static,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/server_proto.rs.html#37-50' title='goto source code'>[src]</a></span></h4>
<div class='stability'><div class='stab deprecated'>Deprecated since 0.11.11<p>: All usage of the tokio-proto crate is going away.</p>
</div></div><div class='docblock'><p>Use this <code>Http</code> instance to create a new server task which handles the
connection <code>io</code> provided.</p>
<h1 id="deprecated" class="section-header"><a href="#deprecated">Deprecated</a></h1>
<p>This method is deprecated. If seeking a replacement, consider
<code>Http::serve_connection</code>.</p>
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl&lt;B:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt; + 'static&gt; <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt;</code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#119-301' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#122-130' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a new instance of the HTTP protocol, ready to spawn a server or
start accepting connections.</p>
</div><h4 id='method.keep_alive' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>W <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='keep_alive.v' class='invisible'><code>pub fn <a href='#method.keep_alive' class='fnname'>keep_alive</a>(&amp;mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#135-138' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Enables or disables HTTP keep-alive.</p>
<p>Default is true.</p>
</div><h4 id='method.max_buf_size' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>W <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='max_buf_size.v' class='invisible'><code>pub fn <a href='#method.max_buf_size' class='fnname'>max_buf_size</a>(&amp;mut self, max: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#141-144' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the maximum buffer size for the connection.</p>
</div><h4 id='method.pipeline' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>W <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='pipeline.v' class='invisible'><code>pub fn <a href='#method.pipeline' class='fnname'>pipeline</a>(&amp;mut self, enabled: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#151-154' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Aggregates flushes to better support pipelined responses.</p>
<p>Experimental, may be have bugs.</p>
<p>Default is false.</p>
</div><h4 id='method.sleep_on_errors' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>W <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='sleep_on_errors.v' class='invisible'><code>pub fn <a href='#method.sleep_on_errors' class='fnname'>sleep_on_errors</a>(&amp;mut self, enabled: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#163-166' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>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 &quot;connection reset&quot;) can be ignored, some
(like &quot;too many files open&quot;) may consume 100% CPU and a timout of 10ms
is used in that case.</p>
<p>Default is false.</p>
</div><h4 id='method.bind' class="method"><span id='bind.v' class='invisible'><code>pub fn <a href='#method.bind' class='fnname'>bind</a>&lt;S, Bd&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;addr: &amp;<a class="enum" href="https://doc.rust-lang.org/nightly/std/net/addr/enum.SocketAddr.html" title="enum std::net::addr::SocketAddr">SocketAddr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;new_service: S<br>) -&gt; <a class="type" href="../../hyper/error/type.Result.html" title="type hyper::error::Result">Result</a>&lt;<a class="struct" href="../../hyper/server/struct.Server.html" title="struct hyper::server::Server">Server</a>&lt;S, Bd&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../../hyper/server/trait.NewService.html" title="trait hyper::server::NewService">NewService</a>&lt;Request = <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>, Response = <a class="struct" href="../../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;Bd&gt;, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#178-193' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Bind the provided <code>addr</code> and return a server ready to handle
connections.</p>
<p>This method will bind the <code>addr</code> provided with a new TCP listener ready
to accept connections. Each connection will be processed with the
<code>new_service</code> object provided as well, creating a new service per
connection.</p>
<p>The returned <code>Server</code> contains one method, <code>run</code>, which is used to
actually run the server.</p>
</div><h4 id='method.serve_addr_handle' class="method"><span id='serve_addr_handle.v' class='invisible'><code>pub fn <a href='#method.serve_addr_handle' class='fnname'>serve_addr_handle</a>&lt;S, Bd&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;addr: &amp;<a class="enum" href="https://doc.rust-lang.org/nightly/std/net/addr/enum.SocketAddr.html" title="enum std::net::addr::SocketAddr">SocketAddr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;handle: &amp;<a class="struct" href="../../tokio_core/reactor/struct.Handle.html" title="struct tokio_core::reactor::Handle">Handle</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;new_service: S<br>) -&gt; <a class="type" href="../../hyper/error/type.Result.html" title="type hyper::error::Result">Result</a>&lt;<a class="struct" href="../../hyper/server/struct.Serve.html" title="struct hyper::server::Serve">Serve</a>&lt;<a class="struct" href="../../hyper/server/struct.AddrIncoming.html" title="struct hyper::server::AddrIncoming">AddrIncoming</a>, S&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../../hyper/server/trait.NewService.html" title="trait hyper::server::NewService">NewService</a>&lt;Request = <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>, Response = <a class="struct" href="../../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;Bd&gt;, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#216-226' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Bind the provided <code>addr</code> and return a server with a shared <code>Core</code>.</p>
<p>This method allows the ability to share a <code>Core</code> with multiple servers.</p>
<p>This is method will bind the <code>addr</code> provided with a new TCP listener ready
to accept connections. Each connection will be processed with the
<code>new_service</code> object provided as well, creating a new service per
connection.</p>
</div><h4 id='method.serve_incoming' class="method"><span id='serve_incoming.v' class='invisible'><code>pub fn <a href='#method.serve_incoming' class='fnname'>serve_incoming</a>&lt;I, S, Bd&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;incoming: I, <br>&nbsp;&nbsp;&nbsp;&nbsp;new_service: S<br>) -&gt; <a class="struct" href="../../hyper/server/struct.Serve.html" title="struct hyper::server::Serve">Serve</a>&lt;I, S&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Error = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="../../futures/stream/trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="../../tokio_io/async_read/trait.AsyncRead.html" title="trait tokio_io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="../../tokio_io/async_write/trait.AsyncWrite.html" title="trait tokio_io::async_write::AsyncWrite">AsyncWrite</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../../hyper/server/trait.NewService.html" title="trait hyper::server::NewService">NewService</a>&lt;Request = <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>, Response = <a class="struct" href="../../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;Bd&gt;, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#231-248' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Bind the provided stream of incoming IO objects with a <code>NewService</code>.</p>
<p>This method allows the ability to share a <code>Core</code> with multiple servers.</p>
</div><h4 id='method.serve_connection' class="method"><span id='serve_connection.v' class='invisible'><code>pub fn <a href='#method.serve_connection' class='fnname'>serve_connection</a>&lt;S, I, Bd&gt;(&amp;self, io: I, service: S) -&gt; <a class="struct" href="../../hyper/server/conn/struct.Connection.html" title="struct hyper::server::conn::Connection">Connection</a>&lt;I, S&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>&lt;Request = <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>, Response = <a class="struct" href="../../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;Bd&gt;, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Bd::<a class="type" href="../../futures/stream/trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../tokio_io/async_read/trait.AsyncRead.html" title="trait tokio_io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="../../tokio_io/async_write/trait.AsyncWrite.html" title="trait tokio_io::async_write::AsyncWrite">AsyncWrite</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#282-300' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Bind a connection together with a Service.</p>
<p>This returns a Future that must be polled in order for HTTP to be
driven on the connection.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">http</span> <span class="op">=</span> <span class="ident">Http</span>::<span class="op">&lt;</span><span class="ident">hyper</span>::<span class="ident">Chunk</span><span class="op">&gt;</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">conn</span> <span class="op">=</span> <span class="ident">http</span>.<span class="ident">serve_connection</span>(<span class="ident">some_io</span>, <span class="ident">some_service</span>);
<span class="kw">let</span> <span class="ident">fut</span> <span class="op">=</span> <span class="ident">conn</span>
.<span class="ident">map</span>(<span class="op">|</span>_<span class="op">|</span> ())
.<span class="ident">map_err</span>(<span class="op">|</span><span class="ident">e</span><span class="op">|</span> <span class="macro">eprintln</span><span class="macro">!</span>(<span class="string">&quot;server connection error: {}&quot;</span>, <span class="ident">e</span>));
<span class="ident">some_handle</span>.<span class="ident">spawn</span>(<span class="ident">fut</span>);</pre>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-ServerProto%3CT%3E' class='impl'><span class='in-band'><code>impl&lt;T, B&gt; <a class="trait" href="../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html" title="trait tokio_proto::streaming::pipeline::server::ServerProto">ServerProto</a>&lt;T&gt; for <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../tokio_io/async_read/trait.AsyncRead.html" title="trait tokio_io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="../../tokio_io/async_write/trait.AsyncWrite.html" title="trait tokio_io::async_write::AsyncWrite">AsyncWrite</a> + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt; + 'static,&nbsp;</span></code><a href='#impl-ServerProto%3CT%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/server_proto.rs.html#88-114' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Request' class="type"><span id='Request.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.Request' class="type">Request</a> = __ProtoRequest</code></span></h4>
<div class='docblock'><p>Request headers.</p>
</div><h4 id='associatedtype.RequestBody' class="type"><span id='RequestBody.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.RequestBody' class="type">RequestBody</a> = <a class="struct" href="../../hyper/struct.Chunk.html" title="struct hyper::Chunk">Chunk</a></code></span></h4>
<div class='docblock'><p>Request body chunks.</p>
</div><h4 id='associatedtype.Response' class="type"><span id='Response.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.Response' class="type">Response</a> = __ProtoResponse</code></span></h4>
<div class='docblock'><p>Response headers.</p>
</div><h4 id='associatedtype.ResponseBody' class="type"><span id='ResponseBody.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.ResponseBody' class="type">ResponseBody</a> = B</code></span></h4>
<div class='docblock'><p>Response body chunks.</p>
</div><h4 id='associatedtype.Error' class="type"><span id='Error.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a></code></span></h4>
<div class='docblock'><p>Errors, which are used both for error frames and for the service itself.</p>
</div><h4 id='associatedtype.Transport' class="type"><span id='Transport.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.Transport' class="type">Transport</a> = __ProtoTransport&lt;T, B&gt;</code></span></h4>
<div class='docblock'><p>The frame transport, which usually take <code>T</code> as a parameter.</p>
</div><h4 id='associatedtype.BindTransport' class="type"><span id='BindTransport.t' class='invisible'><code>type <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.BindTransport' class="type">BindTransport</a> = __ProtoBindTransport&lt;T, B&gt;</code></span></h4>
<div class='docblock'><p>A future for initializing a transport from an I/O object. <a href="../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.BindTransport">Read more</a></p>
</div><h4 id='method.bind_transport' class="method"><span id='bind_transport.v' class='invisible'><code>fn <a href='../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#tymethod.bind_transport' class='fnname'>bind_transport</a>(&amp;self, io: T) -&gt; Self::<a class="type" href="../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#associatedtype.BindTransport" title="type tokio_proto::streaming::pipeline::server::ServerProto::BindTransport">BindTransport</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/server_proto.rs.html#101-113' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Build a transport from the given I/O object, using <code>self</code> for any configuration. <a href="../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html#tymethod.bind_transport">Read more</a></p>
</div></div><h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl&lt;B&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt;</code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#305-311' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#306-310' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl&lt;B&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a>&lt;B&gt;</code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#313-320' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/mod.rs.html#314-319' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "hyper";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>