deploy: 7546c64e791e7d8f67d12b0a9fc74031ec1b8cba

This commit is contained in:
korken89 2022-01-17 07:18:16 +00:00
parent 27d9be4784
commit bea095ef08
17 changed files with 411 additions and 22 deletions

View File

@ -1,5 +1,5 @@
<!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="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../heapless/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Crate heapless</h2><div class="block version"><p>Version 0.7.9</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><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><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">List of all items</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>
</span>
</h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="struct.Deque.html">Deque</a></li><li><a href="struct.HistoryBuffer.html">HistoryBuffer</a></li><li><a href="struct.IndexMap.html">IndexMap</a></li><li><a href="struct.IndexSet.html">IndexSet</a></li><li><a href="struct.LinearMap.html">LinearMap</a></li><li><a href="struct.String.html">String</a></li><li><a href="struct.Vec.html">Vec</a></li><li><a href="binary_heap/struct.BinaryHeap.html">binary_heap::BinaryHeap</a></li><li><a href="binary_heap/struct.PeekMut.html">binary_heap::PeekMut</a></li><li><a href="mpmc/struct.MpMcQueue.html">mpmc::MpMcQueue</a></li><li><a href="pool/struct.Box.html">pool::Box</a></li><li><a href="pool/struct.Node.html">pool::Node</a></li><li><a href="pool/struct.Pool.html">pool::Pool</a></li><li><a href="pool/singleton/struct.Box.html">pool::singleton::Box</a></li><li><a href="pool/singleton/arc/struct.Arc.html">pool::singleton::arc::Arc</a></li><li><a href="pool/singleton/arc/struct.ArcInner.html">pool::singleton::arc::ArcInner</a></li><li><a href="sorted_linked_list/struct.FindMut.html">sorted_linked_list::FindMut</a></li><li><a href="sorted_linked_list/struct.Iter.html">sorted_linked_list::Iter</a></li><li><a href="sorted_linked_list/struct.LinkedIndexU16.html">sorted_linked_list::LinkedIndexU16</a></li><li><a href="sorted_linked_list/struct.LinkedIndexU8.html">sorted_linked_list::LinkedIndexU8</a></li><li><a href="sorted_linked_list/struct.LinkedIndexUsize.html">sorted_linked_list::LinkedIndexUsize</a></li><li><a href="sorted_linked_list/struct.Max.html">sorted_linked_list::Max</a></li><li><a href="sorted_linked_list/struct.Min.html">sorted_linked_list::Min</a></li><li><a href="sorted_linked_list/struct.Node.html">sorted_linked_list::Node</a></li><li><a href="sorted_linked_list/struct.SortedLinkedList.html">sorted_linked_list::SortedLinkedList</a></li><li><a href="spsc/struct.Consumer.html">spsc::Consumer</a></li><li><a href="spsc/struct.Iter.html">spsc::Iter</a></li><li><a href="spsc/struct.IterMut.html">spsc::IterMut</a></li><li><a href="spsc/struct.Producer.html">spsc::Producer</a></li><li><a href="spsc/struct.Queue.html">spsc::Queue</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="binary_heap/enum.Max.html">binary_heap::Max</a></li><li><a href="binary_heap/enum.Min.html">binary_heap::Min</a></li><li><a href="pool/enum.Init.html">pool::Init</a></li><li><a href="pool/enum.Uninit.html">pool::Uninit</a></li></ul><h3 id="Traits">Traits</h3><ul class="traits docblock"><li><a href="binary_heap/trait.Kind.html">binary_heap::Kind</a></li><li><a href="pool/singleton/trait.Pool.html">pool::singleton::Pool</a></li><li><a href="pool/singleton/arc/trait.Pool.html">pool::singleton::arc::Pool</a></li><li><a href="sorted_linked_list/trait.Kind.html">sorted_linked_list::Kind</a></li><li><a href="sorted_linked_list/trait.SortedLinkedListIndex.html">sorted_linked_list::SortedLinkedListIndex</a></li></ul><h3 id="Typedefs">Typedefs</h3><ul class="typedefs docblock"><li><a href="type.FnvIndexMap.html">FnvIndexMap</a></li><li><a href="type.FnvIndexSet.html">FnvIndexSet</a></li><li><a href="mpmc/type.Q16.html">mpmc::Q16</a></li><li><a href="mpmc/type.Q2.html">mpmc::Q2</a></li><li><a href="mpmc/type.Q32.html">mpmc::Q32</a></li><li><a href="mpmc/type.Q4.html">mpmc::Q4</a></li><li><a href="mpmc/type.Q64.html">mpmc::Q64</a></li><li><a href="mpmc/type.Q8.html">mpmc::Q8</a></li></ul></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="heapless" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
</h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="struct.Deque.html">Deque</a></li><li><a href="struct.HistoryBuffer.html">HistoryBuffer</a></li><li><a href="struct.IndexMap.html">IndexMap</a></li><li><a href="struct.IndexSet.html">IndexSet</a></li><li><a href="struct.LinearMap.html">LinearMap</a></li><li><a href="struct.OldestOrdered.html">OldestOrdered</a></li><li><a href="struct.String.html">String</a></li><li><a href="struct.Vec.html">Vec</a></li><li><a href="binary_heap/struct.BinaryHeap.html">binary_heap::BinaryHeap</a></li><li><a href="binary_heap/struct.PeekMut.html">binary_heap::PeekMut</a></li><li><a href="mpmc/struct.MpMcQueue.html">mpmc::MpMcQueue</a></li><li><a href="pool/struct.Box.html">pool::Box</a></li><li><a href="pool/struct.Node.html">pool::Node</a></li><li><a href="pool/struct.Pool.html">pool::Pool</a></li><li><a href="pool/singleton/struct.Box.html">pool::singleton::Box</a></li><li><a href="pool/singleton/arc/struct.Arc.html">pool::singleton::arc::Arc</a></li><li><a href="pool/singleton/arc/struct.ArcInner.html">pool::singleton::arc::ArcInner</a></li><li><a href="sorted_linked_list/struct.FindMut.html">sorted_linked_list::FindMut</a></li><li><a href="sorted_linked_list/struct.Iter.html">sorted_linked_list::Iter</a></li><li><a href="sorted_linked_list/struct.LinkedIndexU16.html">sorted_linked_list::LinkedIndexU16</a></li><li><a href="sorted_linked_list/struct.LinkedIndexU8.html">sorted_linked_list::LinkedIndexU8</a></li><li><a href="sorted_linked_list/struct.LinkedIndexUsize.html">sorted_linked_list::LinkedIndexUsize</a></li><li><a href="sorted_linked_list/struct.Max.html">sorted_linked_list::Max</a></li><li><a href="sorted_linked_list/struct.Min.html">sorted_linked_list::Min</a></li><li><a href="sorted_linked_list/struct.Node.html">sorted_linked_list::Node</a></li><li><a href="sorted_linked_list/struct.SortedLinkedList.html">sorted_linked_list::SortedLinkedList</a></li><li><a href="spsc/struct.Consumer.html">spsc::Consumer</a></li><li><a href="spsc/struct.Iter.html">spsc::Iter</a></li><li><a href="spsc/struct.IterMut.html">spsc::IterMut</a></li><li><a href="spsc/struct.Producer.html">spsc::Producer</a></li><li><a href="spsc/struct.Queue.html">spsc::Queue</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="binary_heap/enum.Max.html">binary_heap::Max</a></li><li><a href="binary_heap/enum.Min.html">binary_heap::Min</a></li><li><a href="pool/enum.Init.html">pool::Init</a></li><li><a href="pool/enum.Uninit.html">pool::Uninit</a></li></ul><h3 id="Traits">Traits</h3><ul class="traits docblock"><li><a href="binary_heap/trait.Kind.html">binary_heap::Kind</a></li><li><a href="pool/singleton/trait.Pool.html">pool::singleton::Pool</a></li><li><a href="pool/singleton/arc/trait.Pool.html">pool::singleton::arc::Pool</a></li><li><a href="sorted_linked_list/trait.Kind.html">sorted_linked_list::Kind</a></li><li><a href="sorted_linked_list/trait.SortedLinkedListIndex.html">sorted_linked_list::SortedLinkedListIndex</a></li></ul><h3 id="Typedefs">Typedefs</h3><ul class="typedefs docblock"><li><a href="type.FnvIndexMap.html">FnvIndexMap</a></li><li><a href="type.FnvIndexSet.html">FnvIndexSet</a></li><li><a href="mpmc/type.Q16.html">mpmc::Q16</a></li><li><a href="mpmc/type.Q2.html">mpmc::Q2</a></li><li><a href="mpmc/type.Q32.html">mpmc::Q32</a></li><li><a href="mpmc/type.Q4.html">mpmc::Q4</a></li><li><a href="mpmc/type.Q64.html">mpmc::Q64</a></li><li><a href="mpmc/type.Q8.html">mpmc::Q8</a></li></ul></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="heapless" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
<script src="../main.js"></script>
</body></html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../heapless/struct.OldestOrdered.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../heapless/struct.OldestOrdered.html">../../heapless/struct.OldestOrdered.html</a>...</p>
<script>location.replace("../../heapless/struct.OldestOrdered.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -71,6 +71,7 @@ objects in the list will not cause a performance hit.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.IndexMap.html" title="heapless::IndexMap struct">IndexMap</a></div><div class="item-right docblock-short"><p>Fixed capacity <a href="https://docs.rs/indexmap/1/indexmap/map/struct.IndexMap.html"><code>IndexMap</code></a></p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.IndexSet.html" title="heapless::IndexSet struct">IndexSet</a></div><div class="item-right docblock-short"><p>Fixed capacity <a href="https://docs.rs/indexmap/1/indexmap/set/struct.IndexSet.html"><code>IndexSet</code></a>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.LinearMap.html" title="heapless::LinearMap struct">LinearMap</a></div><div class="item-right docblock-short"><p>A fixed capacity map / dictionary that performs lookups via linear search</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.OldestOrdered.html" title="heapless::OldestOrdered struct">OldestOrdered</a></div><div class="item-right docblock-short"><p>An iterator on the underlying buffer ordered from oldest data to newest</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.String.html" title="heapless::String struct">String</a></div><div class="item-right docblock-short"><p>A fixed capacity <a href="https://doc.rust-lang.org/std/string/struct.String.html"><code>String</code></a></p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Vec.html" title="heapless::Vec struct">Vec</a></div><div class="item-right docblock-short"><p>A fixed capacity <a href="https://doc.rust-lang.org/std/vec/struct.Vec.html"><code>Vec</code></a></p>
</div></div></div><h2 id="types" class="section-header"><a href="#types">Type Definitions</a></h2>

View File

@ -1 +1 @@
initSidebarItems({"mod":[["binary_heap","A priority queue implemented with a binary heap."],["mpmc","A fixed capacity Multiple-Producer Multiple-Consumer (MPMC) lock-free queue"],["pool","A heap-less, interrupt-safe, lock-free memory pool (*)"],["sorted_linked_list","A fixed sorted priority linked list, similar to `BinaryHeap` but with different properties on `push`, `pop`, etc. For example, the sorting of the list will never `memcpy` the underlying value, so having large objects in the list will not cause a performance hit."],["spsc","Fixed capacity Single Producer Single Consumer (SPSC) queue"]],"struct":[["Deque","A fixed capacity double-ended queue."],["HistoryBuffer","A “history buffer”, similar to a write-only ring buffer of fixed length."],["IndexMap","Fixed capacity `IndexMap`"],["IndexSet","Fixed capacity `IndexSet`."],["LinearMap","A fixed capacity map / dictionary that performs lookups via linear search"],["String","A fixed capacity `String`"],["Vec","A fixed capacity `Vec`"]],"type":[["FnvIndexMap","A `heapless::IndexMap` using the default FNV hasher"],["FnvIndexSet","A `heapless::IndexSet` using the default FNV hasher. A list of all Methods and Traits available for `FnvIndexSet` can be found in the `heapless::IndexSet` documentation."]]});
initSidebarItems({"mod":[["binary_heap","A priority queue implemented with a binary heap."],["mpmc","A fixed capacity Multiple-Producer Multiple-Consumer (MPMC) lock-free queue"],["pool","A heap-less, interrupt-safe, lock-free memory pool (*)"],["sorted_linked_list","A fixed sorted priority linked list, similar to `BinaryHeap` but with different properties on `push`, `pop`, etc. For example, the sorting of the list will never `memcpy` the underlying value, so having large objects in the list will not cause a performance hit."],["spsc","Fixed capacity Single Producer Single Consumer (SPSC) queue"]],"struct":[["Deque","A fixed capacity double-ended queue."],["HistoryBuffer","A “history buffer”, similar to a write-only ring buffer of fixed length."],["IndexMap","Fixed capacity `IndexMap`"],["IndexSet","Fixed capacity `IndexSet`."],["LinearMap","A fixed capacity map / dictionary that performs lookups via linear search"],["OldestOrdered","An iterator on the underlying buffer ordered from oldest data to newest"],["String","A fixed capacity `String`"],["Vec","A fixed capacity `Vec`"]],"type":[["FnvIndexMap","A `heapless::IndexMap` using the default FNV hasher"],["FnvIndexSet","A `heapless::IndexSet` using the default FNV hasher. A list of all Methods and Traits available for `FnvIndexSet` can be found in the `heapless::IndexSet` documentation."]]});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
(function() {var implementors = {};
implementors["heapless"] = [{"text":"impl&lt;'a, T, Idx, K, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/sorted_linked_list/struct.Iter.html\" title=\"struct heapless::sorted_linked_list::Iter\">Iter</a>&lt;'a, T, Idx, K, N&gt; <span class=\"where fmt-newline\">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/cmp/trait.Ord.html\" title=\"trait core::cmp::Ord\">Ord</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Idx: <a class=\"trait\" href=\"heapless/sorted_linked_list/trait.SortedLinkedListIndex.html\" title=\"trait heapless::sorted_linked_list::SortedLinkedListIndex\">SortedLinkedListIndex</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class=\"trait\" href=\"heapless/sorted_linked_list/trait.Kind.html\" title=\"trait heapless::sorted_linked_list::Kind\">Kind</a>,&nbsp;</span>","synthetic":false,"types":["heapless::sorted_linked_list::Iter"]},{"text":"impl&lt;'a, T, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/spsc/struct.Iter.html\" title=\"struct heapless::spsc::Iter\">Iter</a>&lt;'a, T, N&gt;","synthetic":false,"types":["heapless::spsc::Iter"]},{"text":"impl&lt;'a, T, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/spsc/struct.IterMut.html\" title=\"struct heapless::spsc::IterMut\">IterMut</a>&lt;'a, T, N&gt;","synthetic":false,"types":["heapless::spsc::IterMut"]}];
implementors["heapless"] = [{"text":"impl&lt;'a, T, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/struct.OldestOrdered.html\" title=\"struct heapless::OldestOrdered\">OldestOrdered</a>&lt;'a, T, N&gt;","synthetic":false,"types":["heapless::histbuf::OldestOrdered"]},{"text":"impl&lt;'a, T, Idx, K, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/sorted_linked_list/struct.Iter.html\" title=\"struct heapless::sorted_linked_list::Iter\">Iter</a>&lt;'a, T, Idx, K, N&gt; <span class=\"where fmt-newline\">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/cmp/trait.Ord.html\" title=\"trait core::cmp::Ord\">Ord</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Idx: <a class=\"trait\" href=\"heapless/sorted_linked_list/trait.SortedLinkedListIndex.html\" title=\"trait heapless::sorted_linked_list::SortedLinkedListIndex\">SortedLinkedListIndex</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class=\"trait\" href=\"heapless/sorted_linked_list/trait.Kind.html\" title=\"trait heapless::sorted_linked_list::Kind\">Kind</a>,&nbsp;</span>","synthetic":false,"types":["heapless::sorted_linked_list::Iter"]},{"text":"impl&lt;'a, T, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/spsc/struct.Iter.html\" title=\"struct heapless::spsc::Iter\">Iter</a>&lt;'a, T, N&gt;","synthetic":false,"types":["heapless::spsc::Iter"]},{"text":"impl&lt;'a, T, const N:&nbsp;<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.57.0/core/primitive.usize.html\">usize</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.57.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"heapless/spsc/struct.IterMut.html\" title=\"struct heapless::spsc::IterMut\">IterMut</a>&lt;'a, T, N&gt;","synthetic":false,"types":["heapless::spsc::IterMut"]}];
if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -315,6 +315,122 @@
<span id="315">315</span>
<span id="316">316</span>
<span id="317">317</span>
<span id="318">318</span>
<span id="319">319</span>
<span id="320">320</span>
<span id="321">321</span>
<span id="322">322</span>
<span id="323">323</span>
<span id="324">324</span>
<span id="325">325</span>
<span id="326">326</span>
<span id="327">327</span>
<span id="328">328</span>
<span id="329">329</span>
<span id="330">330</span>
<span id="331">331</span>
<span id="332">332</span>
<span id="333">333</span>
<span id="334">334</span>
<span id="335">335</span>
<span id="336">336</span>
<span id="337">337</span>
<span id="338">338</span>
<span id="339">339</span>
<span id="340">340</span>
<span id="341">341</span>
<span id="342">342</span>
<span id="343">343</span>
<span id="344">344</span>
<span id="345">345</span>
<span id="346">346</span>
<span id="347">347</span>
<span id="348">348</span>
<span id="349">349</span>
<span id="350">350</span>
<span id="351">351</span>
<span id="352">352</span>
<span id="353">353</span>
<span id="354">354</span>
<span id="355">355</span>
<span id="356">356</span>
<span id="357">357</span>
<span id="358">358</span>
<span id="359">359</span>
<span id="360">360</span>
<span id="361">361</span>
<span id="362">362</span>
<span id="363">363</span>
<span id="364">364</span>
<span id="365">365</span>
<span id="366">366</span>
<span id="367">367</span>
<span id="368">368</span>
<span id="369">369</span>
<span id="370">370</span>
<span id="371">371</span>
<span id="372">372</span>
<span id="373">373</span>
<span id="374">374</span>
<span id="375">375</span>
<span id="376">376</span>
<span id="377">377</span>
<span id="378">378</span>
<span id="379">379</span>
<span id="380">380</span>
<span id="381">381</span>
<span id="382">382</span>
<span id="383">383</span>
<span id="384">384</span>
<span id="385">385</span>
<span id="386">386</span>
<span id="387">387</span>
<span id="388">388</span>
<span id="389">389</span>
<span id="390">390</span>
<span id="391">391</span>
<span id="392">392</span>
<span id="393">393</span>
<span id="394">394</span>
<span id="395">395</span>
<span id="396">396</span>
<span id="397">397</span>
<span id="398">398</span>
<span id="399">399</span>
<span id="400">400</span>
<span id="401">401</span>
<span id="402">402</span>
<span id="403">403</span>
<span id="404">404</span>
<span id="405">405</span>
<span id="406">406</span>
<span id="407">407</span>
<span id="408">408</span>
<span id="409">409</span>
<span id="410">410</span>
<span id="411">411</span>
<span id="412">412</span>
<span id="413">413</span>
<span id="414">414</span>
<span id="415">415</span>
<span id="416">416</span>
<span id="417">417</span>
<span id="418">418</span>
<span id="419">419</span>
<span id="420">420</span>
<span id="421">421</span>
<span id="422">422</span>
<span id="423">423</span>
<span id="424">424</span>
<span id="425">425</span>
<span id="426">426</span>
<span id="427">427</span>
<span id="428">428</span>
<span id="429">429</span>
<span id="430">430</span>
<span id="431">431</span>
<span id="432">432</span>
<span id="433">433</span>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">core::fmt</span>;
<span class="kw">use</span> <span class="ident">core::mem::MaybeUninit</span>;
<span class="kw">use</span> <span class="ident">core::ops::Deref</span>;
@ -498,6 +614,38 @@
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_slice</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="kw-2">&amp;</span>[<span class="ident">T</span>] {
<span class="kw">unsafe</span> { <span class="ident">slice::from_raw_parts</span>(<span class="self">self</span>.<span class="ident">data</span>.<span class="ident">as_ptr</span>() <span class="kw">as</span> <span class="kw-2">*</span><span class="kw">const</span> <span class="kw">_</span>, <span class="self">self</span>.<span class="ident">len</span>()) }
}
<span class="doccomment">/// Returns an iterator for iterating over the buffer from oldest to newest.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// # Examples</span>
<span class="doccomment">///</span>
<span class="doccomment">/// ```</span>
<span class="doccomment">/// use heapless::HistoryBuffer;</span>
<span class="doccomment">///</span>
<span class="doccomment">/// let mut buffer: HistoryBuffer&lt;u8, 6&gt; = HistoryBuffer::new();</span>
<span class="doccomment">/// buffer.extend([0, 0, 0, 1, 2, 3, 4, 5, 6]);</span>
<span class="doccomment">/// let expected = [1, 2, 3, 4, 5, 6];</span>
<span class="doccomment">/// for (x, y) in buffer.oldest_ordered().zip(expected.iter()) {</span>
<span class="doccomment">/// assert_eq!(x, y)</span>
<span class="doccomment">/// }</span>
<span class="doccomment">///</span>
<span class="doccomment">/// ```</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">oldest_ordered</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> <span class="self">self</span>) -&gt; <span class="ident">OldestOrdered</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span>, <span class="ident">T</span>, <span class="ident">N</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">filled</span> {
<span class="ident">OldestOrdered</span> {
<span class="ident">buf</span>: <span class="self">self</span>,
<span class="ident">cur</span>: <span class="self">self</span>.<span class="ident">write_at</span>,
<span class="ident">wrapped</span>: <span class="bool-val">false</span>,
}
} <span class="kw">else</span> {
<span class="comment">// special case: act like we wrapped already to handle empty buffer.</span>
<span class="ident">OldestOrdered</span> {
<span class="ident">buf</span>: <span class="self">self</span>,
<span class="ident">cur</span>: <span class="number">0</span>,
<span class="ident">wrapped</span>: <span class="bool-val">true</span>,
}
}
}
}
<span class="kw">impl</span><span class="op">&lt;</span><span class="ident">T</span>, <span class="kw">const</span> <span class="ident">N</span>: <span class="ident">usize</span><span class="op">&gt;</span> <span class="ident">Extend</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">HistoryBuffer</span><span class="op">&lt;</span><span class="ident">T</span>, <span class="ident">N</span><span class="op">&gt;</span> {
@ -564,9 +712,38 @@
}
}
<span class="doccomment">/// An iterator on the underlying buffer ordered from oldest data to newest</span>
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Clone</span>)]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">OldestOrdered</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span>, <span class="ident">T</span>, <span class="kw">const</span> <span class="ident">N</span>: <span class="ident">usize</span><span class="op">&gt;</span> {
<span class="ident">buf</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> <span class="ident">HistoryBuffer</span><span class="op">&lt;</span><span class="ident">T</span>, <span class="ident">N</span><span class="op">&gt;</span>,
<span class="ident">cur</span>: <span class="ident">usize</span>,
<span class="ident">wrapped</span>: <span class="ident">bool</span>,
}
<span class="kw">impl</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span>, <span class="ident">T</span>, <span class="kw">const</span> <span class="ident">N</span>: <span class="ident">usize</span><span class="op">&gt;</span> <span class="ident">Iterator</span> <span class="kw">for</span> <span class="ident">OldestOrdered</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span>, <span class="ident">T</span>, <span class="ident">N</span><span class="op">&gt;</span> {
<span class="kw">type</span> <span class="ident">Item</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> <span class="ident">T</span>;
<span class="kw">fn</span> <span class="ident">next</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> <span class="ident">T</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">cur</span> <span class="op">==</span> <span class="self">self</span>.<span class="ident">buf</span>.<span class="ident">len</span>() <span class="op">&amp;&amp;</span> <span class="self">self</span>.<span class="ident">buf</span>.<span class="ident">filled</span> {
<span class="comment">// roll-over</span>
<span class="self">self</span>.<span class="ident">cur</span> <span class="op">=</span> <span class="number">0</span>;
<span class="self">self</span>.<span class="ident">wrapped</span> <span class="op">=</span> <span class="bool-val">true</span>;
}
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">cur</span> <span class="op">==</span> <span class="self">self</span>.<span class="ident">buf</span>.<span class="ident">write_at</span> <span class="op">&amp;&amp;</span> <span class="self">self</span>.<span class="ident">wrapped</span> {
<span class="kw">return</span> <span class="prelude-val">None</span>;
}
<span class="kw">let</span> <span class="ident">item</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">buf</span>[<span class="self">self</span>.<span class="ident">cur</span>];
<span class="self">self</span>.<span class="ident">cur</span> <span class="op">+</span><span class="op">=</span> <span class="number">1</span>;
<span class="prelude-val">Some</span>(<span class="ident">item</span>)
}
}
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="kw">mod</span> <span class="ident">tests</span> {
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::HistoryBuffer</span>;
<span class="kw">use</span> <span class="ident">core::fmt::Debug</span>;
<span class="attribute">#[<span class="ident">test</span>]</span>
<span class="kw">fn</span> <span class="ident">new</span>() {
@ -631,6 +808,61 @@
<span class="macro">assert_eq!</span>(<span class="ident">x</span>.<span class="ident">as_slice</span>(), [<span class="number">5</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
}
<span class="attribute">#[<span class="ident">test</span>]</span>
<span class="kw">fn</span> <span class="ident">ordered</span>() {
<span class="comment">// test on an empty buffer</span>
<span class="kw">let</span> <span class="ident">buffer</span>: <span class="ident">HistoryBuffer</span><span class="op">&lt;</span><span class="ident">u8</span>, <span class="number">6</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">HistoryBuffer::new</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">buffer</span>.<span class="ident">oldest_ordered</span>();
<span class="macro">assert_eq!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);
<span class="comment">// test on a un-filled buffer</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buffer</span>: <span class="ident">HistoryBuffer</span><span class="op">&lt;</span><span class="ident">u8</span>, <span class="number">6</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">HistoryBuffer::new</span>();
<span class="ident">buffer</span>.<span class="ident">extend</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);
<span class="macro">assert_eq!</span>(<span class="ident">buffer</span>.<span class="ident">len</span>(), <span class="number">3</span>);
<span class="ident">assert_eq_iter</span>(<span class="ident">buffer</span>.<span class="ident">oldest_ordered</span>(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);
<span class="comment">// test on a filled buffer</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buffer</span>: <span class="ident">HistoryBuffer</span><span class="op">&lt;</span><span class="ident">u8</span>, <span class="number">6</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">HistoryBuffer::new</span>();
<span class="ident">buffer</span>.<span class="ident">extend</span>([<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
<span class="macro">assert_eq!</span>(<span class="ident">buffer</span>.<span class="ident">len</span>(), <span class="number">6</span>);
<span class="ident">assert_eq_iter</span>(<span class="ident">buffer</span>.<span class="ident">oldest_ordered</span>(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
<span class="comment">// comprehensive test all cases</span>
<span class="kw">for</span> <span class="ident">n</span> <span class="kw">in</span> <span class="number">0</span>..<span class="number">50</span> {
<span class="kw">const</span> <span class="ident">N</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">7</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buffer</span>: <span class="ident">HistoryBuffer</span><span class="op">&lt;</span><span class="ident">u8</span>, <span class="ident">N</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">HistoryBuffer::new</span>();
<span class="ident">buffer</span>.<span class="ident">extend</span>(<span class="number">0</span>..<span class="ident">n</span>);
<span class="ident">assert_eq_iter</span>(
<span class="ident">buffer</span>.<span class="ident">oldest_ordered</span>().<span class="ident">copied</span>(),
<span class="ident">n</span>.<span class="ident">saturating_sub</span>(<span class="ident">N</span> <span class="kw">as</span> <span class="ident">u8</span>)..<span class="ident">n</span>,
);
}
}
<span class="doccomment">/// Compares two iterators item by item, making sure they stop at the same time.</span>
<span class="kw">fn</span> <span class="ident">assert_eq_iter</span><span class="op">&lt;</span><span class="ident">I</span>: <span class="ident">Eq</span> <span class="op">+</span> <span class="ident">Debug</span><span class="op">&gt;</span>(
<span class="ident">a</span>: <span class="kw">impl</span> <span class="ident">IntoIterator</span><span class="op">&lt;</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">I</span><span class="op">&gt;</span>,
<span class="ident">b</span>: <span class="kw">impl</span> <span class="ident">IntoIterator</span><span class="op">&lt;</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">I</span><span class="op">&gt;</span>,
) {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> <span class="ident">a</span>.<span class="ident">into_iter</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">b</span>.<span class="ident">into_iter</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">i</span> <span class="op">=</span> <span class="number">0</span>;
<span class="kw">loop</span> {
<span class="kw">let</span> <span class="ident">a_item</span> <span class="op">=</span> <span class="ident">a</span>.<span class="ident">next</span>();
<span class="kw">let</span> <span class="ident">b_item</span> <span class="op">=</span> <span class="ident">b</span>.<span class="ident">next</span>();
<span class="macro">assert_eq!</span>(<span class="ident">a_item</span>, <span class="ident">b_item</span>, <span class="string">&quot;{}&quot;</span>, <span class="ident">i</span>);
<span class="ident">i</span> <span class="op">+</span><span class="op">=</span> <span class="number">1</span>;
<span class="kw">if</span> <span class="ident">b_item</span>.<span class="ident">is_none</span>() {
<span class="kw">break</span>;
}
}
}
}
</code></pre></div>
</section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="heapless" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>

View File

@ -191,7 +191,7 @@
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">binary_heap::BinaryHeap</span>;
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">deque::Deque</span>;
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">histbuf::HistoryBuffer</span>;
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">histbuf</span>::{<span class="ident">HistoryBuffer</span>, <span class="ident">OldestOrdered</span>};
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">indexmap</span>::{<span class="ident">Bucket</span>, <span class="ident">FnvIndexMap</span>, <span class="ident">IndexMap</span>, <span class="ident">Pos</span>};
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">indexset</span>::{<span class="ident">FnvIndexSet</span>, <span class="ident">IndexSet</span>};
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident">linear_map::LinearMap</span>;