<!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="Fixed capacity `IndexSet`."><title>IndexSet in arduboy_rust::heapless - 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-fa3bb1812debf86c.css"><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.75.0-nightly (2bbb61989 2023-10-04)"data-channel="nightly"data-search-js="search-8be46b629f5f14a8.js"data-settings-js="settings-74424d7eec62a23e.js"><scriptsrc="../../static.files/storage-fec3eaa3851e447d.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../static.files/main-c5bd66d33317d69f.js"></script><noscript><linkrel="stylesheet"href="../../static.files/noscript-5d8b3c7633ad77ba.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></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="#">IndexSet</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">contains</a></li><li><ahref="#method.difference">difference</a></li><li><ahref="#method.first">first</a></li><li><ahref="#method.insert">insert</a></li><li><ahref="#method.intersection">intersection</a></li><li><ahref="#method.is_disjoint">is_disjoint</a></li><li><ahref="#method.is_empty">is_empty</a></li><li><ahref="#method.is_subset">is_subset</a></li><li><ahref="#method.is_superset">is_superset</a></li><li><ahref="#method.iter">iter</a></li><li><ahref="#method.last">last</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.symmetric_difference">symmetric_difference</a></li><li><ahref="#method.union">union</a></li></ul><h3><ahref="#trait-implementations">Trait Implementations</a></h3><ulclass="block"><li><ahref="#impl-Clone-for-IndexSet%3CT,+S,+N%3E">Clone</a></li><li><ahref="#impl-Debug-for-IndexSet%3CT,+S,+N%3E">Debug</a></li><li><ahref="#impl-Default-for-IndexSet%3CT,+S,+N%3E">Default</a></li><li><ahref="#impl-Extend%3C%26'a+T%3E-for-
S: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.capacity"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#105">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 the set can hold</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.iter"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#125">source</a><h4class="code-header">pub fn <ahref="#method.iter"class="fn">iter</a>(&self) -> Iter<'_, T></h4></section></summary><divclass="docblock"><p>Return an iterator over the values of the set, in their order</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.first"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#134">source</a><h4class="code-header">pub fn <ahref="#method.first"class="fn">first</a>(&self) -> Option<&T></h4></section></summary><divclass="docblock"><p>Get the first value</p>
<p>Computes in <strong>O(1)</strong> time</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.last"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#141">source</a><h4class="code-header">pub fn <ahref="#method.last"class="fn">last</a>(&self) -> Option<&T></h4></section></summary><divclass="docblock"><p>Get the last value</p>
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h4></section></summary><divclass="docblock"><p>Visits the values representing the difference, i.e. the values that are in <code>self</code> but not in
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h4></section></summary><divclass="docblock"><p>Visits the values representing the symmetric difference, i.e. the values that are in <code>self</code>
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h4></section></summary><divclass="docblock"><p>Visits the values representing the intersection, i.e. the values that are both in <code>self</code> and
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h4></section></summary><divclass="docblock"><p>Visits the values representing the union, i.e. all the values in <code>self</code> or <code>other</code>, without
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.len"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#287">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 the set.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_empty"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#303">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 <code>true</code> if the set contains no elements.</p>
Q: Eq + <aclass="trait"href="../../hash32/trait.Hash.html"title="trait hash32::Hash">Hash</a> + ?Sized,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the set contains a value.</p>
<p>The value may be any borrowed form of the set’s value type, but <code>Hash</code> and <code>Eq</code> on the
borrowed form must match those for the value type.</p>
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if <code>self</code> has no elements in common with <code>other</code>. This is equivalent to
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the set is a subset of another, i.e. <code>other</code> contains at least all the
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.insert"class="method"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#437">source</a><h4class="code-header">pub fn <ahref="#method.insert"class="fn">insert</a>(&mut self, value: T) -> Result<bool, T></h4></section></summary><divclass="docblock"><p>Adds a value to the set.</p>
<p>If the set did not have this value present, <code>true</code> is returned.</p>
<p>If the set did have this value present, <code>false</code> is returned.</p>
Q: Eq + <aclass="trait"href="../../hash32/trait.Hash.html"title="trait hash32::Hash">Hash</a> + ?Sized,</span></h4></section></summary><divclass="docblock"><p>Removes a value from the set. Returns <code>true</code> if the value was present in the set.</p>
<p>The value may be any borrowed form of the set’s value type, but <code>Hash</code> and <code>Eq</code> on the
borrowed form must match those for the value type.</p>
I: IntoIterator<Item = &'a T>,</span></h4></section></summary><divclass='docblock'>Extends a collection with the contents of an iterator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_one-1"class="method trait-impl"><ahref="#method.extend_one-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Extends a collection with exactly one element.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_reserve-1"class="method trait-impl"><ahref="#method.extend_reserve-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_reserve</a>(&mut self, additional: usize)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Reserves capacity in a collection for the given number of additional elements. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Extend%3CT%3E-for-IndexSet%3CT,+S,+N%3E"class="impl"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#515">source</a><ahref="#impl-Extend%3CT%3E-for-IndexSet%3CT,+S,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, S, const N: usize> Extend<T> for <aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S, N><spanclass="where fmt-newline">where
I: IntoIterator<Item = T>,</span></h4></section></summary><divclass='docblock'>Extends a collection with the contents of an iterator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_one"class="method trait-impl"><ahref="#method.extend_one"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Extends a collection with exactly one element.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_reserve"class="method trait-impl"><ahref="#method.extend_reserve"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_reserve</a>(&mut self, additional: usize)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Reserves capacity in a collection for the given number of additional elements. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-FromIterator%3CT%3E-for-IndexSet%3CT,+S,+N%3E"class="impl"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#541">source</a><ahref="#impl-FromIterator%3CT%3E-for-IndexSet%3CT,+S,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, S, const N: usize> FromIterator<T> for <aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S, N><spanclass="where fmt-newline">where
S: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</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 T</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, T></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/indexset.rs.html#564">source</a><ahref="#method.into_iter"class="anchor">§</a><h4class="code-header">fn <aclass="fn">into_iter</a>(self) -><&'a <aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S, 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%3CIndexSet%3CT,+S2,+N2%3E%3E-for-IndexSet%3CT,+S1,+N1%3E"class="impl"><aclass="src rightside"href="../../src/heapless/indexset.rs.html#503-504">source</a><ahref="#impl-PartialEq%3CIndexSet%3CT,+S2,+N2%3E%3E-for-IndexSet%3CT,+S1,+N1%3E"class="anchor">§</a><h3class="code-header">impl<T, S1, S2, const N1: usize, const N2: usize> PartialEq<<aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S2, N2>> for <aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S1, N1><spanclass="where fmt-newline">where
S2: <aclass="trait"href="../../hash32/trait.BuildHasher.html"title="trait hash32::BuildHasher">BuildHasher</a>,</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/indexset.rs.html#510">source</a><ahref="#method.eq"class="anchor">§</a><h4class="code-header">fn <aclass="fn">eq</a>(&self, other: &<aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S2, 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></div><h2id="synthetic-implementations"class="small-section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor">§</a></h2><divid="synthetic-implementations-list"><sectionid="impl-RefUnwindSafe-for-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-RefUnwindSafe-for-IndexSet%3CT,+S,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, S, const N: usize> RefUnwindSafe for <aclass="struct"href="struct.IndexSet.html"title="struct arduboy_rust::heapless::IndexSet">IndexSet</a><T, S, N><spanclass="where fmt-newline">where
T: 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-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-Any-for-IndexSet%3CT,+S,+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-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-Borrow%3CT%3E-for-IndexSet%3CT,+S,+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-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-BorrowMut%3CT%3E-for-IndexSet%3CT,+S,+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-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-From%3CT%3E-for-IndexSet%3CT,+S,+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-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-Into%3CU%3E-for-IndexSet%3CT,+S,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, U> Into<U> for T<spanclass="where fmt-newline">where
<p>That is, this conversion is whatever the implementation of
<code>[From]<T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-TryFrom%3CU%3E-for-IndexSet%3CT,+S,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, U> TryFrom<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-IndexSet%3CT,+S,+N%3E"class="impl"><ahref="#impl-TryInto%3CU%3E-for-IndexSet%3CT,+S,+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>