225 lines
No EOL
44 KiB
HTML
225 lines
No EOL
44 KiB
HTML
<!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">☰</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<T></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'>−</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<B = <a class="struct" href="../../hyper/struct.Chunk.html" title="struct hyper::Chunk">Chunk</a>> { /* 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<B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<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>> + 'static> <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a><B></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><S, I, Bd>(<br> &self, <br> handle: &<a class="struct" href="../../tokio_core/reactor/struct.Handle.html" title="struct tokio_core::reactor::Handle">Handle</a>, <br> io: I, <br> 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> service: S<br>) <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a><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><Bd>, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>> + 'static,<br> Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>> + 'static,<br> 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, </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<B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<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>> + 'static> <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a><B></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>() -> <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a><B></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">&'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">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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">&'a mut </a>R <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, W> <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">&'a mut </a>W <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, 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> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> 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>, </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> = <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>>::<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>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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">&'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">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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">&'a mut </a>R <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, W> <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">&'a mut </a>W <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, 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> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> 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>, </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> = <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>>::<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>(&mut self, max: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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">&'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">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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">&'a mut </a>R <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, W> <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">&'a mut </a>W <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, 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> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> 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>, </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> = <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>>::<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>(&mut self, enabled: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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">&'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">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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">&'a mut </a>R <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, W> <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">&'a mut </a>W <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, 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> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> 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>, </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> = <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>>::<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>(&mut self, enabled: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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 "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.</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><S, Bd>(<br> &self, <br> 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> new_service: S<br>) -> <a class="type" href="../../hyper/error/type.Result.html" title="type hyper::error::Result">Result</a><<a class="struct" href="../../hyper/server/struct.Server.html" title="struct hyper::server::Server">Server</a><S, Bd>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.NewService.html" title="trait hyper::server::NewService">NewService</a><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><Bd>, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>> + 'static,<br> Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>, </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><S, Bd>(<br> &self, <br> 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> handle: &<a class="struct" href="../../tokio_core/reactor/struct.Handle.html" title="struct tokio_core::reactor::Handle">Handle</a>, <br> new_service: S<br>) -> <a class="type" href="../../hyper/error/type.Result.html" title="type hyper::error::Result">Result</a><<a class="struct" href="../../hyper/server/struct.Serve.html" title="struct hyper::server::Serve">Serve</a><<a class="struct" href="../../hyper/server/struct.AddrIncoming.html" title="struct hyper::server::AddrIncoming">AddrIncoming</a>, S>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.NewService.html" title="trait hyper::server::NewService">NewService</a><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><Bd>, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>,<br> Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>, </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><I, S, Bd>(<br> &self, <br> incoming: I, <br> new_service: S<br>) -> <a class="struct" href="../../hyper/server/struct.Serve.html" title="struct hyper::server::Serve">Serve</a><I, S> <span class="where fmt-newline">where<br> I: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><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>>,<br> 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> S: <a class="trait" href="../../hyper/server/trait.NewService.html" title="trait hyper::server::NewService">NewService</a><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><Bd>, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>,<br> Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><Item = B, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>, </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><S, I, Bd>(&self, io: I, service: S) -> <a class="struct" href="../../hyper/server/conn/struct.Connection.html" title="struct hyper::server::conn::Connection">Connection</a><I, S> <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a><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><Bd>, Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>,<br> Bd: <a class="trait" href="../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><Error = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>>,<br> 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><<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>>,<br> 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>, </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"><</span><span class="ident">hyper</span>::<span class="ident">Chunk</span><span class="op">></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">"server connection error: {}"</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<T, B> <a class="trait" href="../../tokio_proto/streaming/pipeline/server/trait.ServerProto.html" title="trait tokio_proto::streaming::pipeline::server::ServerProto">ServerProto</a><T> for <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a><B> <span class="where fmt-newline">where<br> 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> B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<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>> + 'static, </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<T, B></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<T, B></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>(&self, io: T) -> 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<B> <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><B></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>(&self) -> <a class="struct" href="../../hyper/server/struct.Http.html" title="struct hyper::server::Http">Http</a><B></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>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</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<B> <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><B></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>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <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>⏎</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> |