<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="A fixed capacity map / dictionary that performs lookups via linear search"><title>LinearMap in arduboy_rust::prelude - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../static.files/rustdoc-cb6f1f67f1bcd037.css"id="mainThemeStyle"><metaname="rustdoc-vars"data-root-path="../../"data-static-root-path="../../static.files/"data-current-crate="arduboy_rust"data-themes=""data-resource-suffix=""data-rustdoc-version="1.73.0-nightly (8131b9774 2023-08-02)"data-channel="nightly"data-search-js="search-6dfdfced5eff6596.js"data-settings-js="settings-de11bff964e9d4e5.js"data-settings-css="settings-8c76f75bfb6bd192.css"data-theme-light-css="light-6d2c9675f3d09c26.css"data-theme-dark-css="dark-45ceb8f2e522f4d1.css"data-theme-ayu-css="ayu-fd19013d6ce078bf.css"><scriptsrc="../../static.files/storage-db41da1a38ea3cb8.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-0795b7d26be81095.js"></script><noscript><linkrel="stylesheet"media="(prefers-color-scheme:light)"href="../../static.files/light-6d2c9675f3d09c26.css"><linkrel="stylesheet"media="(prefers-color-scheme:dark)"href="../../static.files/dark-45ceb8f2e522f4d1.css"><linkrel="stylesheet"href="../../static.files/noscript-cffde32267a19fd6.css"></noscript><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="logo-container"href="../../arduboy_rust/index.html"><imgclass="rust-logo"src="../../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2></h2></nav><navclass="sidebar"><aclass="logo-container"href="../../arduboy_rust/index.html"><imgclass="rust-logo"src="../../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2class="location"><ahref="#">LinearMap</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block"><li><ahref="#method.capacity">capacity</a></li><li><ahref="#method.clear">clear</a></li><li><ahref="#method.contains_key">contains_key</a></li><li><ahref="#method.get">get</a></li><li><ahref="#method.get_mut">get_mut</a></li><li><ahref="#method.insert">insert</a></li><li><ahref="#method.is_empty">is_empty</a></li><li><ahref="#method.iter">iter</a></li><li><ahref="#method.iter_mut">iter_mut</a></li><li><ahref="#method.keys">keys</a></li><li><ahref="#method.len">len</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.remove">remove</a></li><li><ahref="#method.values">values</a></li><li><ahref="#method.values_mut">values_mut</a></li></ul><h3><ahref="#trait-i
K: Eq,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.capacity"class="method"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#47">source</a><h4class="code-header">pub fn <ahref="#method.capacity"class="fn">capacity</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the number of elements that the map can hold</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.contains_key"class="method"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#83">source</a><h4class="code-header">pub fn <ahref="#method.contains_key"class="fn">contains_key</a>(&self, key: &K) -> bool</h4></section></summary><divclass="docblock"><p>Returns true if the map contains a value for the specified key.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.len"class="method"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#151">source</a><h4class="code-header">pub fn <ahref="#method.len"class="fn">len</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the number of elements in this map</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_empty"class="method"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#200">source</a><h4class="code-header">pub fn <ahref="#method.is_empty"class="fn">is_empty</a>(&self) -> bool</h4></section></summary><divclass="docblock"><p>Returns true if the map contains no elements</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.iter_mut"class="method"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#248">source</a><h4class="code-header">pub fn <ahref="#method.iter_mut"class="fn">iter_mut</a>(&mut self) -> IterMut<'_, K, V></h4></section></summary><divclass="docblock"><p>An iterator visiting all key-value pairs in arbitrary order, with mutable references to the
Q: Eq + ?Sized,</span></h4></section></summary><divclass="docblock"><p>Removes a key from the map, returning the value at the key if the key was previously in the
I: IntoIterator<Item = (K, V)>,</span></h4></section></summary><divclass='docblock'>Creates a value from an iterator. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Index%3C%26'a+Q%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#348">source</a><ahref="#impl-Index%3C%26'a+Q%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<'a, K, V, Q, const N: usize> Index<&'a Q> for <aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N><spanclass="where fmt-newline">where
K: Borrow<Q> + Eq,
Q: Eq + ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Output"class="associatedtype trait-impl"><ahref="#associatedtype.Output"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Output</a> = V</h4></section></summary><divclass='docblock'>The returned type after indexing.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.index"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#355">source</a><ahref="#method.index"class="anchor">§</a><h4class="code-header">fn <aclass="fn">index</a>(&self, key: &Q) ->&V</h4></section></summary><divclass='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-IndexMut%3C%26'a+Q%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#360">source</a><ahref="#impl-IndexMut%3C%26'a+Q%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<'a, K, V, Q, const N: usize> IndexMut<&'a Q> for <aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N><spanclass="where fmt-newline">where
K: Eq,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Item"class="associatedtype trait-impl"><ahref="#associatedtype.Item"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Item</a> = (&'a K, &'a V)</h4></section></summary><divclass='docblock'>The type of the elements being iterated over.</div></details><detailsclass="toggle"open><summary><sectionid="associatedtype.IntoIter"class="associatedtype trait-impl"><ahref="#associatedtype.IntoIter"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">IntoIter</a> = Iter<'a, K, V></h4></section></summary><divclass='docblock'>Which kind of iterator are we turning this into?</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.into_iter"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#439">source</a><ahref="#method.into_iter"class="anchor">§</a><h4class="code-header">fn <aclass="fn">into_iter</a>(self) -><&'a <aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N> as IntoIterator>::IntoIter</h4></section></summary><divclass='docblock'>Creates an iterator from a value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq%3CLinearMap%3CK,+V,+N2%3E%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#485">source</a><ahref="#impl-PartialEq%3CLinearMap%3CK,+V,+N2%3E%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<K, V, const N: usize, const N2: usize> PartialEq<<aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N2>> for <aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N><spanclass="where fmt-newline">where
K: Eq,
V: PartialEq<V>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq"class="method trait-impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#490">source</a><ahref="#method.eq"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, other: &<aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N2>) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne"class="method trait-impl"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><ahref="#method.ne"class="anchor">§</a><h4class="code-header">fn <aclass="fn">ne</a>(&self, other: &Rhs) -> bool</h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><sectionid="impl-Eq-for-LinearMap%3CK,+V,+N%3E"class="impl"><aclass="src rightside"href="../../src/heapless/linear_map.rs.html#498">source</a><ahref="#impl-Eq-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<K, V, const N: usize> Eq for <aclass="struct"href="../heapless/struct.LinearMap.html"title="struct arduboy_rust::heapless::LinearMap">LinearMap</a><K, V, N><spanclass="where fmt-newline">where
V: UnwindSafe,</span></h3></section></div><h2id="blanket-implementations"class="small-section-header">Blanket Implementations<ahref="#blanket-implementations"class="anchor">§</a></h2><divid="blanket-implementations-list"><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Any-for-LinearMap%3CK,+V,+N%3E"class="impl"><ahref="#impl-Any-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> Any for T<spanclass="where fmt-newline">where
T: 'static + ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.type_id"class="method trait-impl"><ahref="#method.type_id"class="anchor">§</a><h4class="code-header">fn <aclass="fn">type_id</a>(&self) -> TypeId</h4></section></summary><divclass='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Borrow%3CT%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><ahref="#impl-Borrow%3CT%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> Borrow<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow"class="method trait-impl"><ahref="#method.borrow"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow</a>(&self) ->&T</h4></section></summary><divclass='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-BorrowMut%3CT%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><ahref="#impl-BorrowMut%3CT%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> BorrowMut<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow_mut"class="method trait-impl"><ahref="#method.borrow_mut"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow_mut</a>(&mut self) ->&mut T</h4></section></summary><divclass='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-From%3CT%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><ahref="#impl-From%3CT%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> From<T> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from"class="method trait-impl"><ahref="#method.from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from</a>(t: T) -> T</h4></section></summary><divclass="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Into%3CU%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><ahref="#impl-Into%3CU%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, U> Into<U> for T<spanclass="where fmt-newline">where
U: Into<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = Infallible</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-LinearMap%3CK,+V,+N%3E"class="impl"><ahref="#impl-TryInto%3CU%3E-for-LinearMap%3CK,+V,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, U> TryInto<U> for T<spanclass="where fmt-newline">where
U: TryFrom<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>