<!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 `OrderedMap` struct in crate `phf`.">
<meta name="keywords" content="rust, rustlang, rust-lang, OrderedMap">
<title>phf::OrderedMap - 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'>phf</a></p><script>window.sidebarCurrent = {name: 'OrderedMap', 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'>phf</a>::<wbr><a class='struct' href=''>OrderedMap</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-258' class='srclink' href='../src/phf/ordered_map.rs.html#21-30' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct OrderedMap<K: 'static, V: 'static> {
// some fields omitted
}</pre><div class='docblock'><p>An order-preserving immutable map constructed at compile time.</p>
<p>Unlike a <code>Map</code>, iteration order is guaranteed to match the definition
order.</p>
<h2 id='note' class='section-header'><a href='#note'>Note</a></h2>
<p>The fields of this struct are public so that they may be initialized by the
<code>phf_ordered_map!</code> macro and code generation. They are subject to change at
any time and should never be accessed directly.</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<K, V> <a class='struct' href='../phf/ordered_map/struct.OrderedMap.html' title='phf::ordered_map::OrderedMap'>OrderedMap</a><K, V></code></h3><div class='impl-items'><h4 id='method.len' class='method'><code>fn <a href='#method.len' class='fnname'>len</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code></h4>
<div class='docblock'><p>Returns the number of entries in the <code>Map</code>.</p>
</div><h4 id='method.is_empty' class='method'><code>fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
<div class='docblock'><p>Returns true if the <code>Map</code> is empty.</p>
</div><h4 id='method.get' class='method'><code>fn <a href='#method.get' class='fnname'>get</a><T: ?<a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html' title='core::marker::Sized'>Sized</a>>(&self, key: &T) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&V> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> + <a class='trait' href='../phf/trait.PhfHash.html' title='phf::PhfHash'>PhfHash</a>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><T></span></code></h4>
<div class='docblock'><p>Returns a reference to the value that <code>key</code> maps to.</p>
</div><h4 id='method.get_key' class='method'><code>fn <a href='#method.get_key' class='fnname'>get_key</a><T: ?<a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html' title='core::marker::Sized'>Sized</a>>(&self, key: &T) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&K> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> + <a class='trait' href='../phf/trait.PhfHash.html' title='phf::PhfHash'>PhfHash</a>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><T></span></code></h4>
<div class='docblock'><p>Returns a reference to the map's internal static instance of the given
key.</p>
<p>This can be useful for interning schemes.</p>
</div><h4 id='method.contains_key' class='method'><code>fn <a href='#method.contains_key' class='fnname'>contains_key</a><T: ?<a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html' title='core::marker::Sized'>Sized</a>>(&self, key: &T) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> + <a class='trait' href='../phf/trait.PhfHash.html' title='phf::PhfHash'>PhfHash</a>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><T></span></code></h4>
<div class='docblock'><p>Determines if <code>key</code> is in the <code>Map</code>.</p>
</div><h4 id='method.get_index' class='method'><code>fn <a href='#method.get_index' class='fnname'>get_index</a><T: ?<a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html' title='core::marker::Sized'>Sized</a>>(&self, key: &T) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> + <a class='trait' href='../phf/trait.PhfHash.html' title='phf::PhfHash'>PhfHash</a>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><T></span></code></h4>
<div class='docblock'><p>Returns the index of the key within the list used to initialize
the ordered map.</p>
</div><h4 id='method.index' class='method'><code>fn <a href='#method.index' class='fnname'>index</a>(&self, index: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(&K, &V)</a>></code></h4>
<div class='docblock'><p>Returns references to both the key and values at an index
within the list used to initialize the ordered map. See <code>.get_index(key)</code>.</p>
</div><h4 id='method.get_entry' class='method'><code>fn <a href='#method.get_entry' class='fnname'>get_entry</a><T: ?<a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html' title='core::marker::Sized'>Sized</a>>(&self, key: &T) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(&K, &V)</a>> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> + <a class='trait' href='../phf/trait.PhfHash.html' title='phf::PhfHash'>PhfHash</a>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><T></span></code></h4>
<div class='docblock'><p>Like <code>get</code>, but returns both the key and the value.</p>
</div><h4 id='method.entries' class='method'><code>fn <a href='#method.entries' class='fnname'>entries</a><'a>(&'a self) -> <a class='struct' href='../phf/ordered_map/struct.Entries.html' title='phf::ordered_map::Entries'>Entries</a><'a, K, V></code></h4>
<div class='docblock'><p>Returns an iterator over the key/value pairs in the map.</p>
<p>Entries are returned in the same order in which they were defined.</p>
</div><h4 id='method.keys' class='method'><code>fn <a href='#method.keys' class='fnname'>keys</a><'a>(&'a self) -> <a class='struct' href='../phf/ordered_map/struct.Keys.html' title='phf::ordered_map::Keys'>Keys</a><'a, K, V></code></h4>
<div class='docblock'><p>Returns an iterator over the keys in the map.</p>
<p>Keys are returned in the same order in which they were defined.</p>
</div><h4 id='method.values' class='method'><code>fn <a href='#method.values' class='fnname'>values</a><'a>(&'a self) -> <a class='struct' href='../phf/ordered_map/struct.Values.html' title='phf::ordered_map::Values'>Values</a><'a, K, V></code></h4>
<div class='docblock'><p>Returns an iterator over the values in the map.</p>
<p>Values are returned in the same order in which they were defined.</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl<K, V> <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='../phf/ordered_map/struct.OrderedMap.html' title='phf::ordered_map::OrderedMap'>OrderedMap</a><K, V> <span class='where'>where K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a>, V: <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a></span></code></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#method.fmt' class='fnname'>fmt</a>(&self, fmt: &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><h3 class='impl'><code>impl<'a, K, V, T: ?<a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html' title='core::marker::Sized'>Sized</a>> <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a><&'a T> for <a class='struct' href='../phf/ordered_map/struct.OrderedMap.html' title='phf::ordered_map::OrderedMap'>OrderedMap</a><K, V> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> + <a class='trait' href='../phf/trait.PhfHash.html' title='phf::PhfHash'>PhfHash</a>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><T></span></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = V</code></h4>
<h4 id='method.index-1' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#method.index' class='fnname'>index</a>(&self, k: &'a T) -> &V</code></h4>
</div><h3 class='impl'><code>impl<'a, K, V> <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a> for &'a <a class='struct' href='../phf/ordered_map/struct.OrderedMap.html' title='phf::ordered_map::OrderedMap'>OrderedMap</a><K, V></code></h3><div class='impl-items'><h4 id='assoc_type.Item' class='type'><code>type Item = <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(&'a K, &'a V)</a></code></h4>
<h4 id='assoc_type.IntoIter' class='type'><code>type IntoIter = <a class='struct' href='../phf/ordered_map/struct.Entries.html' title='phf::ordered_map::Entries'>Entries</a><'a, K, V></code></h4>
<h4 id='method.into_iter' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#method.into_iter' class='fnname'>into_iter</a>(self) -> <a class='struct' href='../phf/ordered_map/struct.Entries.html' title='phf::ordered_map::Entries'>Entries</a><'a, K, V></code></h4>
</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>
</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>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "phf";
window.playgroundUrl = "";
</script>
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>