juniper/hyper/server/struct.Server.html
Juniper Documentation Builder 95d942c9d4 Update documentation for Juniper
2016-09-11 18:41:24 +00:00

153 lines
No EOL
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `Server` struct in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Server">
<title>hyper::server::Server - Rust</title>
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a></p><script>window.sidebarCurrent = {name: 'Server', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<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 struct">
<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=''>Server</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 id='src-7533' class='srclink' href='../../src/hyper/server/mod.rs.html#145-148' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Server&lt;L&nbsp;=&nbsp;<a class='struct' href='../../hyper/net/struct.HttpListener.html' title='hyper::net::HttpListener'>HttpListener</a>&gt; {
// some fields omitted
}</pre><div class='docblock'><p>A server can listen on a TCP socket.</p>
<p>Once listening, it will create a <code>Request</code>/<code>Response</code> pair for each
incoming connection, and hand them to the provided handler.</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl&lt;L:&nbsp;<a class='trait' href='../../hyper/net/trait.NetworkListener.html' title='hyper::net::NetworkListener'>NetworkListener</a>&gt; <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;L&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a id='src-7558' class='srclink' href='../../src/hyper/server/mod.rs.html#176-208' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(listener: L) -&gt; <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;L&gt;</code></h4>
<div class='docblock'><p>Creates a new server with the provided handler.</p>
</div><h4 id='method.keep_alive' class='method'><code>fn <a href='#method.keep_alive' class='fnname'>keep_alive</a>(&amp;mut self, timeout: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;)</code></h4>
<div class='docblock'><p>Controls keep-alive for this server.</p>
<p>The timeout duration passed will be used to determine how long
to keep the connection alive before dropping it.</p>
<p>Passing <code>None</code> will disable keep-alive.</p>
<p>Default is enabled with a 5 second timeout.</p>
</div><h4 id='method.set_read_timeout' class='method'><code>fn <a href='#method.set_read_timeout' class='fnname'>set_read_timeout</a>(&amp;mut self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;)</code></h4>
<div class='docblock'><p>Sets the read timeout for all Request reads.</p>
</div><h4 id='method.set_write_timeout' class='method'><code>fn <a href='#method.set_write_timeout' class='fnname'>set_write_timeout</a>(&amp;mut self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;)</code></h4>
<div class='docblock'><p>Sets the write timeout for all Response writes.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;<a class='struct' href='../../hyper/net/struct.HttpListener.html' title='hyper::net::HttpListener'>HttpListener</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a id='src-7571' class='srclink' href='../../src/hyper/server/mod.rs.html#210-215' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.http' class='method'><code>fn <a href='#method.http' class='fnname'>http</a>&lt;To:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html' title='std::net::addr::ToSocketAddrs'>ToSocketAddrs</a>&gt;(addr: To) -&gt; <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;<a class='struct' href='../../hyper/net/struct.HttpListener.html' title='hyper::net::HttpListener'>HttpListener</a>&gt;&gt;</code></h4>
<div class='docblock'><p>Creates a new server that will handle <code>HttpStream</code>s.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;S:&nbsp;<a class='trait' href='../../hyper/net/trait.SslServer.html' title='hyper::net::SslServer'>SslServer</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Send.html' title='core::marker::Send'>Send</a>&gt; <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;<a class='struct' href='../../hyper/net/struct.HttpsListener.html' title='hyper::net::HttpsListener'>HttpsListener</a>&lt;S&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a id='src-7575' class='srclink' href='../../src/hyper/server/mod.rs.html#217-224' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.https' class='method'><code>fn <a href='#method.https' class='fnname'>https</a>&lt;A:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html' title='std::net::addr::ToSocketAddrs'>ToSocketAddrs</a>&gt;(addr: A, ssl: S) -&gt; <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;<a class='struct' href='../../hyper/net/struct.HttpsListener.html' title='hyper::net::HttpsListener'>HttpsListener</a>&lt;S&gt;&gt;&gt;</code></h4>
<div class='docblock'><p>Creates a new server that will handle <code>HttpStream</code>s over SSL.</p>
<p>You can use any SSL implementation, as long as implements <code>hyper::net::Ssl</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;L:&nbsp;<a class='trait' href='../../hyper/net/trait.NetworkListener.html' title='hyper::net::NetworkListener'>NetworkListener</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Send.html' title='core::marker::Send'>Send</a> + 'static&gt; <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;L&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a id='src-7581' class='srclink' href='../../src/hyper/server/mod.rs.html#226-238' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.handle' class='method'><code>fn <a href='#method.handle' class='fnname'>handle</a>&lt;H:&nbsp;<a class='trait' href='../../hyper/server/trait.Handler.html' title='hyper::server::Handler'>Handler</a> + 'static&gt;(self, handler: H) -&gt; <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../hyper/server/struct.Listening.html' title='hyper::server::Listening'>Listening</a>&gt;</code></h4>
<div class='docblock'><p>Binds to a socket and starts handling connections.</p>
</div><h4 id='method.handle_threads' class='method'><code>fn <a href='#method.handle_threads' class='fnname'>handle_threads</a>&lt;H:&nbsp;<a class='trait' href='../../hyper/server/trait.Handler.html' title='hyper::server::Handler'>Handler</a> + 'static&gt;(self, handler: H, threads: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -&gt; <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../hyper/server/struct.Listening.html' title='hyper::server::Listening'>Listening</a>&gt;</code></h4>
<div class='docblock'><p>Binds to a socket and starts handling connections with the provided
number of threads.</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl&lt;L:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a>&gt; <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a>&lt;L&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a id='src-7525' class='srclink' href='../../src/hyper/server/mod.rs.html#144' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4>
<div class='docblock'><p>Formats the value using the given formatter.</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>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand 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";
window.playgroundUrl = "";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>