juniper/hyper/header/enum.IfRange.html

160 lines
7.8 KiB
HTML
Raw Normal View History

2016-09-11 13:41:24 -05: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 `IfRange` enum in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, IfRange">
<title>hyper::header::IfRange - 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: 'IfRange', ty: 'enum', 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 enum">
<h1 class='fqn'><span class='in-band'>Enum <a href='../index.html'>hyper</a>::<wbr><a href='index.html'>header</a>::<wbr><a class='enum' href=''>IfRange</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-3369' class='srclink' href='../../src/hyper/header/common/if_range.rs.html#49-54' title='goto source code'>[src]</a></span></h1>
<pre class='rust enum'>pub enum IfRange {
EntityTag(<a class='struct' href='../../hyper/header/struct.EntityTag.html' title='hyper::header::EntityTag'>EntityTag</a>),
Date(<a class='struct' href='../../hyper/header/struct.HttpDate.html' title='hyper::header::HttpDate'>HttpDate</a>),
}</pre><div class='docblock'><p><code>If-Range</code> header, defined in <a href="http://tools.ietf.org/html/rfc7233#section-3.2">RFC7233</a></p>
<p>If a client has a partial copy of a representation and wishes to have
an up-to-date copy of the entire representation, it could use the
Range header field with a conditional GET (using either or both of
If-Unmodified-Since and If-Match.) However, if the precondition
fails because the representation has been modified, the client would
then have to make a second request to obtain the entire current
representation.</p>
<p>The <code>If-Range</code> header field allows a client to &quot;short-circuit&quot; the
second request. Informally, its meaning is as follows: if the
representation is unchanged, send me the part(s) that I am requesting
in Range; otherwise, send me the entire representation.</p>
<h1 id='abnf' class='section-header'><a href='#abnf'>ABNF</a></h1>
<pre><code class="language-plain">If-Range = entity-tag / HTTP-date
</code></pre>
<h1 id='example-values' class='section-header'><a href='#example-values'>Example values</a></h1>
<ul>
<li><code>Sat, 29 Oct 1994 19:43:31 GMT</code></li>
<li><code>\&quot;xyzzy\&quot;</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'>IfRange</span>, <span class='ident'>EntityTag</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'>IfRange</span>::<span class='ident'>EntityTag</span>(<span class='ident'>EntityTag</span>::<span class='ident'>new</span>(<span class='bool-val'>false</span>, <span class='string'>&quot;xyzzy&quot;</span>.<span class='ident'>to_owned</span>())));</pre>
<pre class='rust rust-example-rendered'>
<span class='comment'>// extern crate time;</span>
<span class='kw'>use</span> <span class='ident'>hyper</span>::<span class='ident'>header</span>::{<span class='ident'>Headers</span>, <span class='ident'>IfRange</span>, <span class='ident'>HttpDate</span>};
<span class='kw'>use</span> <span class='ident'>time</span>::{<span class='self'>self</span>, <span class='ident'>Duration</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'>IfRange</span>::<span class='ident'>Date</span>(<span class='ident'>HttpDate</span>(<span class='ident'>time</span>::<span class='ident'>now</span>() <span class='op'>-</span> <span class='ident'>Duration</span>::<span class='ident'>days</span>(<span class='number'>1</span>))));</pre>
</div><h2 class='variants'>Variants</h2>
<span id='variant.EntityTag' class='variant'><code>EntityTag(<a class='struct' href='../../hyper/header/struct.EntityTag.html' title='hyper::header::EntityTag'>EntityTag</a>)</code></span><div class='docblock'><p>The entity-tag the client has of the resource</p>
</div><span id='variant.Date' class='variant'><code>Date(<a class='struct' href='../../hyper/header/struct.HttpDate.html' title='hyper::header::HttpDate'>HttpDate</a>)</code></span><div class='docblock'><p>The date when the client retrieved the resource</p>
</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>