<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../itertools/all.html"title="show sidebar"></a></div><inputclass="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"><divid="help-button"tabindex="-1"><ahref="../../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Module <ahref="../index.html">itertools</a>::<wbr><aclass="mod"href="#">structs</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../../src/itertools/lib.rs.html#82">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>The concrete iterator types.</p>
</div></details><h2id="structs"class="section-header">Structs<ahref="#structs"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="struct"href="struct.Batching.html"title="struct itertools::structs::Batching">Batching</a></div><divclass="desc docblock-short">A “meta iterator adaptor”. Its closure receives a reference to the iterator
and may pick off as many elements as it likes, to produce the next iterator element.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Chunk.html"title="struct itertools::structs::Chunk">Chunk</a></div><divclass="desc docblock-short">An iterator for the elements in a single chunk.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Chunks.html"title="struct itertools::structs::Chunks">Chunks</a></div><divclass="desc docblock-short">An iterator that yields the Chunk iterators.</div></li><li><divclass="item-name"><aclass="struct"href="struct.CircularTupleWindows.html"title="struct itertools::structs::CircularTupleWindows">CircularTupleWindows</a></div><divclass="desc docblock-short">An iterator over all windows, wrapping back to the first elements when the
window would otherwise exceed the length of the iterator, producing tuples
of a specific size.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Combinations.html"title="struct itertools::structs::Combinations">Combinations</a></div><divclass="desc docblock-short">An iterator to iterate through all the <code>k</code>-length combinations in an iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.CombinationsWithReplacement.html"title="struct itertools::structs::CombinationsWithReplacement">CombinationsWithReplacement</a></div><divclass="desc docblock-short">An iterator to iterate through all the <code>n</code>-length combinations in an iterator, with replacement.</div></li><li><divclass="item-name"><aclass="struct"href="struct.ConsTuples.html"title="struct itertools::structs::ConsTuples">ConsTuples</a></div><divclass="desc docblock-short">An iterator that maps an iterator of tuples like
<code>((A, B), C)</code> to an iterator of <code>(A, B, C)</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.ExactlyOneError.html"title="struct itertools::structs::ExactlyOneError">ExactlyOneError</a></div><divclass="desc docblock-short">Iterator returned for the error case of <code>Itertools::exactly_one()</code>
This iterator yields exactly the same elements as the input iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.FilterMapOk.html"title="struct itertools::structs::FilterMapOk">FilterMapOk</a></div><divclass="desc docblock-short">An iterator adapter to filter and apply a transformation on values within a nested <code>Result::Ok</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.FilterOk.html"title="struct itertools::structs::FilterOk">FilterOk</a></div><divclass="desc docblock-short">An iterator adapter to filter values within a nested <code>Result::Ok</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.FlattenOk.html"title="struct itertools::structs::FlattenOk">FlattenOk</a></div><divclass="desc docblock-short">An iterator adaptor that flattens <code>Result::Ok</code> values and
allows <code>Result::Err</code> values through unchanged.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Format.html"title="struct itertools::structs::Format">Format</a></div><divclass="desc docblock-short">Format all iterator elements lazily, separated by <code>sep</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.FormatWith.html"title="struct itertools::structs::FormatWith">FormatWith</a></div><divclass="desc docblock-short">Format all iterator elements lazily, separated by <code>sep</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Group.html"title="struct itertools::structs::Group">Group</a></div><divclass="desc docblock-short">An iterator for the elements in a single group.</div></li><li><divclass="item-name"><aclass="struct"href="struct.GroupBy.html"title="struct itertools::structs::GroupBy">GroupBy</a></div><divclass="desc docblock-short"><code>GroupBy</code> is the storage for the lazy grouping operation.</div></li><li><divclass="item-name"><aclass="struct"href="struct.GroupingMap.html"title="struct itertools::structs::GroupingMap">GroupingMap</a></div><divclass="desc docblock-short"><code>GroupingMap</code> is an intermediate struct for efficient group-and-fold operations.
It groups elements by their key and at the same time fold each group
using some aggregating operation.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Groups.html"title="struct itertools::structs::Groups">Groups</a></div><divclass="desc docblock-short">An iterator that yields the Group iterators.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Interleave.html"title="struct itertools::structs::Interleave">Interleave</a></div><divclass="desc docblock-short">An iterator adaptor that alternates elements from two iterators until both
run out.</div></li><li><divclass="item-name"><aclass="struct"href="struct.InterleaveShortest.html"title="struct itertools::structs::InterleaveShortest">InterleaveShortest</a></div><divclass="desc docblock-short">An iterator adaptor that alternates elements from the two iterators until
one of them runs out.</div></li><li><divclass="item-name"><aclass="struct"href="struct.IntersperseWith.html"title="struct itertools::structs::IntersperseWith">IntersperseWith</a></div><divclass="desc docblock-short">An iterator adaptor to insert a particular value created by a function
between each element of the adapted iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.IntoChunks.html"title="struct itertools::structs::IntoChunks">IntoChunks</a></div><divclass="desc docblock-short"><code>ChunkLazy</code> is the storage for a lazy chunking operation.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Iterate.html"title="struct itertools::structs::Iterate">Iterate</a></div><divclass="desc docblock-short">An iterator that infinitely applies function to value and yields results.</div></li><li><divclass="item-name"><aclass="struct"href="struct.KMergeBy.html"title="struct itertools::structs::KMergeBy">KMergeBy</a></div><divclass="desc docblock-short">An iterator adaptor that merges an abitrary number of base iterators
according to an ordering function.</div></li><li><divclass="item-name"><aclass="struct"href="struct.MergeBy.html"title="struct itertools::structs::MergeBy">MergeBy</a></div><divclass="desc docblock-short">An iterator adaptor that merges the two base iterators in ascending order.
If both base iterators are sorted (ascending), the result is sorted.</div></li><li><divclass="item-name"><aclass="struct"href="struct.MultiPeek.html"title="struct itertools::structs::MultiPeek">MultiPeek</a></div><divclass="desc docblock-short">See <ahref="../fn.multipeek.html"title="fn itertools::multipeek"><code>multipeek()</code></a> for more information.</div></li><li><divclass="item-name"><aclass="struct"href="struct.MultiProduct.html"title="struct itertools::structs::MultiProduct">MultiProduct</a></div><divclass="desc docblock-short">An iterator adaptor that iterates over the cartesian product of
multiple iterators of type <code>I</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.PadUsing.html"title="struct itertools::structs::PadUsing">PadUsing</a></div><divclass="desc docblock-short">An iterator adaptor that pads a sequence to a minimum length by filling
missing elements using a closure.</div></li><li><divclass="item-name"><aclass="struct"href="struct.PeekNth.html"title="struct itertools::structs::PeekNth">PeekNth</a></div><divclass="desc docblock-short">See <ahref="../fn.peek_nth.html"title="fn itertools::peek_nth"><code>peek_nth()</code></a> for more information.</div></li><li><divclass="item-name"><aclass="struct"href="struct.PeekingTakeWhile.html"title="struct itertools::structs::PeekingTakeWhile">PeekingTakeWhile</a></div><divclass="desc docblock-short">An iterator adaptor that takes items while a closure returns <code>true</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Permutations.html"title="struct itertools::structs::Permutations">Permutations</a></div><divclass="desc docblock-short">An iterator adaptor that iterates through all the <code>k</code>-permutations of the
elements from an iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Positions.html"title="struct itertools::structs::Positions">Positions</a></div><divclass="desc docblock-short">An iterator adapter to get the positions of each element that matches a predicate.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Powerset.html"title="struct itertools::structs::Powerset">Powerset</a></div><divclass="desc docblock-short">An iterator to iterate through the powerset of the elements from an iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.ProcessResults.html"title="struct itertools::structs::ProcessResults">ProcessResults</a></div><divclass="desc docblock-short">An iterator that produces only the <code>T</code> values as long as the
inner iterator produces <code>Ok(T)</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Product.html"title="struct itertools::structs::Product">Product</a></div><divclass="desc docblock-short">An iterator adaptor that iterates over the cartesian product of
the element sets of two iterators <code>I</code> and <code>J</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.PutBack.html"title="struct itertools::structs::PutBack">PutBack</a></div><divclass="desc docblock-short">An iterator adaptor that allows putting back a single
item to the front of the iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.PutBackN.html"title="struct itertools::structs::PutBackN">PutBackN</a></div><divclass="desc docblock-short">An iterator adaptor that allows putting multiple
items in front of the iterator.</div></li><li><divclass="item-name"><aclass="struct"href="struct.RcIter.html"title="struct itertools::structs::RcIter">RcIter</a></div><divclass="desc docblock-short">A wrapper for <code>Rc<RefCell<I>></code>, that implements the <code>Iterator</code> trait.</div></li><li><divclass="item-name"><aclass="struct"href="struct.RepeatCall.html"title="struct itertools::structs::RepeatCall">RepeatCall</a><spanclass="stab deprecated"title="">Deprecated</span></div><divclass="desc docblock-short">See <ahref="../fn.repeat_call.html"title="fn itertools::repeat_call"><code>repeat_call</code></a> for more information.</div></li><li><divclass="item-name"><aclass="struct"href="struct.RepeatN.html"title="struct itertools::structs::RepeatN">RepeatN</a></div><divclass="desc docblock-short">An iterator that produces <em>n</em> repetitions of an element.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Step.html"title="struct itertools::structs::Step">Step</a><spanclass="stab deprecated"title="">Deprecated</span></div><divclass="desc docblock-short">An iterator adaptor that steps a number elements in the base iterator
for each iteration.</div></li><li><divclass="item-name"><aclass="struct"href="struct.TakeWhileInclusive.html"title="struct itertools::structs::TakeWhileInclusive">TakeWhileInclusive</a></div><divclass="desc docblock-short">An iterator adaptor that consumes elements while the given predicate is
<code>true</code>, including the element for which the predicate first returned
<code>false</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.TakeWhileRef.html"title="struct itertools::structs::TakeWhileRef">TakeWhileRef</a></div><divclass="desc docblock-short">An iterator adaptor that borrows from a <code>Clone</code>-able iterator
to only pick off elements while the predicate returns <code>true</code>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Tee.html"title="struct itertools::structs::Tee">Tee</a></div><divclass="desc docblock-short">One half of an iterator pair where both return the same elements.</div></li><li><divclass="item-name"><aclass="struct"href="struct.TupleBuffer.html"title="struct itertools::structs::TupleBuffer">TupleBuffer</a></div><divclass="desc docblock-short">An iterator over a incomplete tuple.</div></li><li><divclass="item-name"><aclass="struct"href="struct.TupleCombinations.html"title="struct itertools::structs::TupleCombinations">TupleCombinations</a></div><divclass="desc docblock-short">An iterator to iterate through all combinations in a <code>Clone</code>-able iterator that produces tuples
of a specific size.</div></li><li><divclass="item-name"><aclass="struct"href="struct.TupleWindows.html"title="struct itertools::structs::TupleWindows">TupleWindows</a></div><divclass="desc docblock-short">An iterator over all contiguous windows that produces tuples of a specific size.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Tuples.html"title="struct itertools::structs::Tuples">Tuples</a></div><divclass="desc docblock-short">An iterator that groups the items in tuples of a specific size.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Unfold.html"title="struct itertools::structs::Unfold">Unfold</a></div><divclass="desc docblock-short">See <ahref="../fn.unfold.html"title="fn itertools::unfold"><code>unfold</code></a> for more information.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Unique.html"title="struct itertools::structs::Unique">Unique</a></div><divclass="desc docblock-short">An iterator adapter to filter out duplicate elements.</div></li><li><divclass="item-name"><aclass="struct"href="struct.UniqueBy.html"title="struct itertools::structs::UniqueBy">UniqueBy</a></div><divclass="desc docblock-short">An iterator adapter to filter out duplicate elements.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Update.html"title="struct itertools::structs::Update">Update</a></div><divclass="desc docblock-short">An iterator adapter to apply a mutating function to each element before yielding it.</div></li><li><divclass="item-name"><aclass="struct"href="struct.WhileSome.html"title="struct itertools::structs::WhileSome">WhileSome</a></div><divclass="desc docblock-short">An iterator adaptor that filters <code>Option<A></code> iterator elements
and produces <code>A</code>. Stops on the first <code>None</code> encountered.</div></li><li><divclass="item-name"><aclass="struct"href="struct.WithPosition.html"title="struct itertools::structs::WithPosition">WithPosition</a></div><divclass="desc docblock-short">An iterator adaptor that wraps each element in an <ahref="../enum.Position.html"title="enum itertools::Position"><code>Position</code></a>.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Zip.html"title="struct itertools::structs::Zip">Zip</a></div><divclass="desc docblock-short">See <ahref="../fn.multizip.html"title="fn itertools::multizip"><code>multizip</code></a> for more information.</div></li><li><divclass="item-name"><aclass="struct"href="struct.ZipEq.html"title="struct itertools::structs::ZipEq">ZipEq</a></div><divclass="desc docblock-short">An iterator which iterates two other iterators simultaneously</div></li><li><divclass="item-name"><aclass="struct"href="struct.ZipLongest.html"title="struct itertools::structs::ZipLongest">ZipLongest</a></div><divclass="desc docblock-short">An iterator which iterates two other iterators simultaneously</div></li></ul><h2id="types"class="section-header">Type Aliases<ahref="#types"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="type"href="type.Coalesce.html"title="type itertools::structs::Coalesce">Coalesce</a></div><divclass="desc docblock-short">An iterator adaptor that may join together adjacent elements.</div></li><li><divclass="item-name"><aclass="type"href="type.Dedup.html"title="type itertools::structs::Dedup">Dedup</a></div><divclass="desc docblock-short">An iterator adaptor that removes repeated duplicates.</div></li><li><divclass="item-name"><aclass="type"href="type.DedupBy.html"title="type itertools::structs::DedupBy">DedupBy</a></div><divclass="desc docblock-short">An iterator adaptor that removes repeated duplicates, determining equality using a comparison function.</div></li><li><divclass="item-name"><aclass="type"href="type.DedupByWithCount.html"title="type itertools::structs::DedupByWithCount">DedupByWithCount</a></div><divclass="desc docblock-short">An iterator adaptor that removes repeated duplicates, while keeping a count of how many
repeated elements were present. This will determine equality using a comparison function.</div></li><li><divclass="item-name"><aclass="type"href="type.DedupWithCount.html"title="type itertools::structs::DedupWithCount">DedupWithCount</a></div><divclass="desc docblock-short">An iterator adaptor that removes repeated duplicates, while keeping a count of how many
repeated elements were present.</div></li><li><divclass="item-name"><aclass="type"href="type.Duplicates.html"title="type itertools::structs::Duplicates">Duplicates</a></div><divclass="desc docblock-short">An iterator adapter to filter out duplicate elements.</div></li><li><divclass="item-name"><aclass="type"href="type.DuplicatesBy.html"title="type itertools::structs::DuplicatesBy">DuplicatesBy</a></div><divclass="desc docblock-short">An iterator adapter to filter for duplicate elements.</div></li><li><divclass="item-name"><aclass="type"href="type.GroupingMapBy.html"title="type itertools::structs::GroupingMapBy">GroupingMapBy</a></div><divclass="desc docblock-short"><code>GroupingMapBy</code> is an intermediate struct for efficient group-and-fold operations.</div></li><li><divclass="item-name"><aclass="type"href="type.Intersperse.html"title="type itertools::structs::Intersperse">Intersperse</a></div><divclass="desc docblock-short">An iterator adaptor to insert a particular value
between each element of the adapted iterator.</div></li><li><divclass="item-name"><aclass="type"href="type.KMerge.html"title="type itertools::structs::KMerge">KMerge</a></div><divclass="desc docblock-short">An iterator adaptor that merges an abitrary number of base iterators in ascending order.
If all base iterators are sorted (ascending), the result is sorted.</div></li><li><divclass="item-name"><aclass="type"href="type.MapInto.html"title="type itertools::structs::MapInto">MapInto</a></div><divclass="desc docblock-short">An iterator adapter to apply <code>Into</code> conversion to each element.</div></li><li><divclass="item-name"><aclass="type"href="type.MapOk.html"title="type itertools::structs::MapOk">MapOk</a></div><divclass="desc docblock-short">An iterator adapter to apply a transformation within a nested <code>Result::Ok</code>.</div></li><li><divclass="item-name"><aclass="type"href="type.MapResults.html"title="type itertools::structs::MapResults">MapResults</a><spanclass="stab deprecated"title="">Deprecated</span></div><divclass="desc docblock-short">See <ahref="type.MapOk.html"title="type itertools::structs::MapOk"><code>MapOk</code></a>.</div></li><li><divclass="item-name"><aclass="type"href="type.Merge.html"title="type itertools::structs::Merge">Merge</a></div><divclass="desc docblock-short">An iterator adaptor that merges the two base iterators in ascending order.
If both base iterators are sorted (ascending), the result is sorted.</div></li><li><divclass="item-name"><aclass="type"href="type.MergeJoinBy.html"title="type itertools::structs::MergeJoinBy">MergeJoinBy</a></div><divclass="desc docblock-short">An iterator adaptor that merge-joins items from the two base iterators in ascending order.</div></li></ul></section></div></main></body></html>