48 lines
7.4 KiB
HTML
48 lines
7.4 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 `indexmap` crate."><meta name="keywords" content="rust, rustlang, rust-lang, indexmap"><title>indexmap - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../indexmap/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate indexmap</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all indexmap's items</p></a><div class="block items"><ul><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'indexmap', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><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 class='srclink' href='../src/indexmap/lib.rs.html#1-164' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>indexmap</a></span></h1><div class='docblock'><p><a href="map/struct.IndexMap.html"><code>IndexMap</code></a> is a hash table where the iteration order of the key-value
|
||
pairs is independent of the hash values of the keys.</p>
|
||
<p><a href="set/struct.IndexSet.html"><code>IndexSet</code></a> is a corresponding hash set using the same implementation and
|
||
with similar properties.</p>
|
||
<h3 id="feature-highlights" class="section-header"><a href="#feature-highlights">Feature Highlights</a></h3>
|
||
<p><a href="map/struct.IndexMap.html"><code>IndexMap</code></a> and <a href="set/struct.IndexSet.html"><code>IndexSet</code></a> are drop-in compatible with the std <code>HashMap</code>
|
||
and <code>HashSet</code>, but they also have some features of note:</p>
|
||
<ul>
|
||
<li>The ordering semantics (see their documentation for details)</li>
|
||
<li>Sorting methods and the [<code>.pop()</code>][IndexMap::pop] methods.</li>
|
||
<li>The [<code>Equivalent</code>] trait, which offers more flexible equality definitions
|
||
between borrowed and owned versions of keys.</li>
|
||
<li>The [<code>MutableKeys</code>][map::MutableKeys] trait, which gives opt-in mutable
|
||
access to hash map keys.</li>
|
||
</ul>
|
||
<h3 id="rust-version" class="section-header"><a href="#rust-version">Rust Version</a></h3>
|
||
<p>This version of indexmap requires Rust 1.18 or later, or 1.30+ for
|
||
development builds, and Rust 1.36+ for using with <code>alloc</code> (without <code>std</code>),
|
||
see below.</p>
|
||
<p>The indexmap 1.x release series will use a carefully considered version
|
||
upgrade policy, where in a later 1.x version, we will raise the minimum
|
||
required Rust version.</p>
|
||
<h2 id="no-standard-library-targets" class="section-header"><a href="#no-standard-library-targets">No Standard Library Targets</a></h2>
|
||
<p>From Rust 1.36, this crate supports being built without <code>std</code>, requiring
|
||
<code>alloc</code> instead. This is enabled automatically when it is detected that
|
||
<code>std</code> is not available. There is no crate feature to enable/disable to
|
||
trigger this. It can be tested by building for a std-less target.</p>
|
||
<ul>
|
||
<li>Creating maps and sets using [<code>new</code>][IndexMap::new] and
|
||
[<code>with_capacity</code>][IndexMap::with_capacity] is unavailable without <code>std</code>.<br />
|
||
Use methods <a href="map/struct.IndexMap.html#impl-Default"><code>IndexMap::default</code></a>,
|
||
[<code>with_hasher</code>][IndexMap::with_hasher],
|
||
[<code>with_capacity_and_hasher</code>][IndexMap::with_capacity_and_hasher] instead.
|
||
A no-std compatible hasher will be needed as well, for example
|
||
from the crate <code>twox-hash</code>.</li>
|
||
<li>Macros [<code>indexmap!</code>] and [<code>indexset!</code>] are unavailable without <code>std</code>.</li>
|
||
</ul>
|
||
</div><h2 id='reexports' class='section-header'><a href="#reexports">Re-exports</a></h2>
|
||
<table><tr><td><code>pub use map::<a class="struct" href="../indexmap/map/struct.IndexMap.html" title="struct indexmap::map::IndexMap">IndexMap</a>;</code></td></tr><tr><td><code>pub use set::<a class="struct" href="../indexmap/set/struct.IndexSet.html" title="struct indexmap::set::IndexSet">IndexSet</a>;</code></td></tr></table><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
||
<table><tr class='module-item'><td><a class="mod" href="map/index.html" title='indexmap::map mod'>map</a></td><td class='docblock-short'><p><code>IndexMap</code> is a hash table where the iteration order of the key-value
|
||
pairs is independent of the hash values of the keys.</p>
|
||
</td></tr><tr class='module-item'><td><a class="mod" href="set/index.html" title='indexmap::set mod'>set</a></td><td class='docblock-short'><p>A hash set implemented using <code>IndexMap</code></p>
|
||
</td></tr></table><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
|
||
<table><tr class='module-item'><td><a class="macro" href="macro.indexmap.html" title='indexmap::indexmap macro'>indexmap</a></td><td class='docblock-short'><p>Create an <code>IndexMap</code> from a list of key-value pairs</p>
|
||
</td></tr><tr class='module-item'><td><a class="macro" href="macro.indexset.html" title='indexmap::indexset macro'>indexset</a></td><td class='docblock-short'><p>Create an <code>IndexSet</code> from a list of values</p>
|
||
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
||
<table><tr class='module-item'><td><a class="trait" href="trait.Equivalent.html" title='indexmap::Equivalent trait'>Equivalent</a></td><td class='docblock-short'><p>Key equivalence trait.</p>
|
||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "indexmap";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |