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

159 lines
No EOL
7.9 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 `Upgrade` struct in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Upgrade">
<title>hyper::header::Upgrade - 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'>header</a></p><script>window.sidebarCurrent = {name: 'Upgrade', 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'>header</a>::<wbr><a class='struct' href=''>Upgrade</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-4365' class='srclink' href='../../src/hyper/header/common/mod.rs.html#246' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Upgrade(pub <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a>&lt;<a class='struct' href='../../hyper/header/struct.Protocol.html' title='hyper::header::Protocol'>Protocol</a>&gt;);</pre><div class='docblock'><p><code>Upgrade</code> header, defined in <a href="http://tools.ietf.org/html/rfc7230#section-6.7">RFC7230</a></p>
<p>The <code>Upgrade</code> header field is intended to provide a simple mechanism
for transitioning from HTTP/1.1 to some other protocol on the same
connection. A client MAY send a list of protocols in the Upgrade
header field of a request to invite the server to switch to one or
more of those protocols, in order of descending preference, before
sending the final response. A server MAY ignore a received Upgrade
header field if it wishes to continue using the current protocol on
that connection. Upgrade cannot be used to insist on a protocol
change.</p>
<h1 id='abnf' class='section-header'><a href='#abnf'>ABNF</a></h1>
<pre><code class="language-plain">Upgrade = 1#protocol
protocol = protocol-name [&quot;/&quot; protocol-version]
protocol-name = token
protocol-version = token
</code></pre>
<h1 id='example-values' class='section-header'><a href='#example-values'>Example values</a></h1>
<ul>
<li><code>HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11</code></li>
</ul>
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>hyper</span>::<span class='ident'>header</span>::{<span class='ident'>Headers</span>, <span class='ident'>Upgrade</span>, <span class='ident'>Protocol</span>, <span class='ident'>ProtocolName</span>};
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>headers</span> <span class='op'>=</span> <span class='ident'>Headers</span>::<span class='ident'>new</span>();
<span class='ident'>headers</span>.<span class='ident'>set</span>(<span class='ident'>Upgrade</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='ident'>Protocol</span>::<span class='ident'>new</span>(<span class='ident'>ProtocolName</span>::<span class='ident'>WebSocket</span>, <span class='prelude-val'>None</span>)]));</pre>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>hyper</span>::<span class='ident'>header</span>::{<span class='ident'>Headers</span>, <span class='ident'>Upgrade</span>, <span class='ident'>Protocol</span>, <span class='ident'>ProtocolName</span>};
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>headers</span> <span class='op'>=</span> <span class='ident'>Headers</span>::<span class='ident'>new</span>();
<span class='ident'>headers</span>.<span class='ident'>set</span>(
<span class='ident'>Upgrade</span>(<span class='macro'>vec</span><span class='macro'>!</span>[
<span class='ident'>Protocol</span>::<span class='ident'>new</span>(<span class='ident'>ProtocolName</span>::<span class='ident'>Http</span>, <span class='prelude-val'>Some</span>(<span class='string'>&quot;2.0&quot;</span>.<span class='ident'>to_owned</span>())),
<span class='ident'>Protocol</span>::<span class='ident'>new</span>(<span class='ident'>ProtocolName</span>::<span class='ident'>Unregistered</span>(<span class='string'>&quot;SHTTP&quot;</span>.<span class='ident'>to_owned</span>()),
<span class='prelude-val'>Some</span>(<span class='string'>&quot;1.3&quot;</span>.<span class='ident'>to_owned</span>())),
<span class='ident'>Protocol</span>::<span class='ident'>new</span>(<span class='ident'>ProtocolName</span>::<span class='ident'>Unregistered</span>(<span class='string'>&quot;IRC&quot;</span>.<span class='ident'>to_owned</span>()),
<span class='prelude-val'>Some</span>(<span class='string'>&quot;6.9&quot;</span>.<span class='ident'>to_owned</span>())),
])
);</pre>
</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>