153 lines
No EOL
13 KiB
HTML
153 lines
No EOL
13 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 `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'>−</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<L = <a class='struct' href='../../hyper/net/struct.HttpListener.html' title='hyper::net::HttpListener'>HttpListener</a>> {
|
||
// 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<L: <a class='trait' href='../../hyper/net/trait.NetworkListener.html' title='hyper::net::NetworkListener'>NetworkListener</a>> <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a><L></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) -> <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a><L></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>(&mut self, timeout: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>>)</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>(&mut self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>>)</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>(&mut self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>>)</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><<a class='struct' href='../../hyper/net/struct.HttpListener.html' title='hyper::net::HttpListener'>HttpListener</a>></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><To: <a class='trait' href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html' title='std::net::addr::ToSocketAddrs'>ToSocketAddrs</a>>(addr: To) -> <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a><<a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a><<a class='struct' href='../../hyper/net/struct.HttpListener.html' title='hyper::net::HttpListener'>HttpListener</a>>></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<S: <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>> <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a><<a class='struct' href='../../hyper/net/struct.HttpsListener.html' title='hyper::net::HttpsListener'>HttpsListener</a><S>></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><A: <a class='trait' href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html' title='std::net::addr::ToSocketAddrs'>ToSocketAddrs</a>>(addr: A, ssl: S) -> <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a><<a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a><<a class='struct' href='../../hyper/net/struct.HttpsListener.html' title='hyper::net::HttpsListener'>HttpsListener</a><S>>></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<L: <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> <a class='struct' href='../../hyper/server/struct.Server.html' title='hyper::server::Server'>Server</a><L></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><H: <a class='trait' href='../../hyper/server/trait.Handler.html' title='hyper::server::Handler'>Handler</a> + 'static>(self, handler: H) -> <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a><<a class='struct' href='../../hyper/server/struct.Listening.html' title='hyper::server::Listening'>Listening</a>></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><H: <a class='trait' href='../../hyper/server/trait.Handler.html' title='hyper::server::Handler'>Handler</a> + 'static>(self, handler: H, threads: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -> <a class='type' href='../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a><<a class='struct' href='../../hyper/server/struct.Listening.html' title='hyper::server::Listening'>Listening</a>></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<L: <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a>> <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><L></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>(&self, __arg_0: &mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <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>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</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> |