edlang/itertools/traits/trait.IteratorIndex.html

20 lines
19 KiB
HTML
Raw Normal View History

<!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="Used by `Itertools::get` to know which iterator to turn different ranges into."><title>IteratorIndex in itertools::traits - Rust</title><script> if (window.location.protocol !== "file:") document.write(`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2">`)</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-e935ef01ae1c1829.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="itertools" data-themes="" data-resource-suffix="" data-rustdoc-version="1.78.0 (9b00956e5 2024-04-29)" data-channel="1.78.0" data-search-js="search-42d8da7a6b9792c2.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-12cf3b4f4f9dc36d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../itertools/index.html">itertools</a><span class="version">0.13.0</span></h2></div><h2 class="location"><a href="#">IteratorIndex</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Output">Output</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.index">index</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-IteratorIndex%3CI%3E-for-Range%3Cusize%3E">Range&lt;usize&gt;</a></li><li><a href="#impl-IteratorIndex%3CI%3E-for-RangeFrom%3Cusize%3E">RangeFrom&lt;usize&gt;</a></li><li><a href="#impl-IteratorIndex%3CI%3E-for-RangeFull">RangeFull</a></li><li><a href="#impl-IteratorIndex%3CI%3E-for-RangeInclusive%3Cusize%3E">RangeInclusive&lt;usize&gt;</a></li><li><a href="#impl-IteratorIndex%3CI%3E-for-RangeTo%3Cusize%3E">RangeTo&lt;usize&gt;</a></li><li><a href="#impl-IteratorIndex%3CI%3E-for-RangeToInclusive%3Cusize%3E">RangeToInclusive&lt;usize&gt;</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In itertools::traits</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../itertools/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">itertools</a>::<wbr><a href="index.html">traits</a>::<wbr><a class="trait" href="#">IteratorIndex</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/itertools/iter_index.rs.html#22-34">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait IteratorIndex&lt;I&gt;: Sealed<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div>{
type <a href="#associatedtype.Output" class="associatedtype">Output</a>: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = I::<a class="associatedtype" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;;
// Required method
fn <a href="#tymethod.index" class="fn">index</a>(self, from: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Used by <a href="../trait.Itertools.html#method.get" title="method itertools::Itertools::get"><code>Itertools::get</code></a> to know which iterator
to turn different ranges into.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Output" class="method"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#27">source</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a>: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = I::<a class="associatedtype" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</h4></section></summary><div class="docblock"><p>The type returned for this type of index.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.index" class="method"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#33">source</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, from: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></summary><div class="docblock"><p>Returns an adapted iterator for the current index.</p>
<p>Prefer calling <a href="../trait.Itertools.html#method.get" title="method itertools::Itertools::get"><code>Itertools::get</code></a> instead
of calling this directly.</p>
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-IteratorIndex%3CI%3E-for-Range%3Cusize%3E" class="impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#36-45">source</a><a href="#impl-IteratorIndex%3CI%3E-for-Range%3Cusize%3E" class="anchor">§</a><h3 class="code-header">impl&lt;I&gt; <a class="trait" href="trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;I&gt; for <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/skip/struct.Skip.html" title="struct core::iter::adapters::skip::Skip">Skip</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/take/struct.Take.html" title="struct core::iter::adapters::take::Take">Take</a>&lt;I&gt;&gt;</h4></section><section id="method.index" class="method trait-impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#42-44">source</a><a href="#method.index" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, iter: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IteratorIndex%3CI%3E-for-RangeFrom%3Cusize%3E" class="impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#88-97">source</a><a href="#impl-IteratorIndex%3CI%3E-for-RangeFrom%3Cusize%3E" class="anchor">§</a><h3 class="code-header">impl&lt;I&gt; <a class="trait" href="trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;I&gt; for <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-2" class="associatedtype trait-impl"><a href="#associatedtype.Output-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/skip/struct.Skip.html" title="struct core::iter::adapters::skip::Skip">Skip</a>&lt;I&gt;</h4></section><section id="method.index-1" class="method trait-impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#94-96">source</a><a href="#method.index-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, iter: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IteratorIndex%3CI%3E-for-RangeFull" class="impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#99-108">source</a><a href="#impl-IteratorIndex%3CI%3E-for-RangeFull" class="anchor">§</a><h3 class="code-header">impl&lt;I&gt; <a class="trait" href="trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;I&gt; for <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a><div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-3" class="associatedtype trait-impl"><a href="#associatedtype.Output-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = I</h4></section><section id="method.index-2" class="method trait-impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#105-107">source</a><a href="#method.index-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, iter: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IteratorIndex%3CI%3E-for-RangeInclusive%3Cusize%3E" class="impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#47-63">source</a><a href="#impl-IteratorIndex%3CI%3E-for-RangeInclusive%3Cusize%3E" class="anchor">§</a><h3 class="code-header">impl&lt;I&gt; <a class="trait" href="trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;I&gt; for <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-4" class="associatedtype trait-impl"><a href="#associatedtype.Output-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/take/struct.Take.html" title="struct core::iter::adapters::take::Take">Take</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/skip/struct.Skip.html" title="struct core::iter::adapters::skip::Skip">Skip</a>&lt;I&gt;&gt;</h4></section><section id="method.index-3" class="method trait-impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#53-62">source</a><a href="#method.index-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, iter: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IteratorIndex%3CI%3E-for-RangeTo%3Cusize%3E" class="impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#65-74">source</a><a href="#impl-IteratorIndex%3CI%3E-for-RangeTo%3Cusize%3E" class="anchor">§</a><h3 class="code-header">impl&lt;I&gt; <a class="trait" href="trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;I&gt; for <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-5" class="associatedtype trait-impl"><a href="#associatedtype.Output-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/take/struct.Take.html" title="struct core::iter::adapters::take::Take">Take</a>&lt;I&gt;</h4></section><section id="method.index-4" class="method trait-impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#71-73">source</a><a href="#method.index-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, iter: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IteratorIndex%3CI%3E-for-RangeToInclusive%3Cusize%3E" class="impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#76-86">source</a><a href="#impl-IteratorIndex%3CI%3E-for-RangeToInclusive%3Cusize%3E" class="anchor">§</a><h3 class="code-header">impl&lt;I&gt; <a class="trait" href="trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;I&gt; for <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.78.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-6" class="associatedtype trait-impl"><a href="#associatedtype.Output-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="https://doc.rust-lang.org/1.78.0/core/iter/adapters/take/struct.Take.html" title="struct core::iter::adapters::take::Take">Take</a>&lt;I&gt;</h4></section><section id="method.index-5" class="method trait-impl"><a class="src rightside" href="../../src/itertools/iter_index.rs.html#82-85">source</a><a href="#method.index-5" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.index" class="fn">index</a>(self, iter: I) -&gt; Self::<a class="associatedtype" href="trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/itertools/iter_index/trait.IteratorIndex.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>