edlang/itertools/trait.Itertools.html
2024-07-26 09:42:18 +00:00

2694 lines
531 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="An `Iterator` blanket implementation that provides extra adaptors and methods."><title>Itertools in itertools - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.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.80.0 (051478957 2024-07-21)" data-channel="1.80.0" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><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="#">Itertools</a></h2><div class="sidebar-elems"><section><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.all_equal">all_equal</a></li><li><a href="#method.all_equal_value">all_equal_value</a></li><li><a href="#method.all_unique">all_unique</a></li><li><a href="#method.at_most_one">at_most_one</a></li><li><a href="#method.batching">batching</a></li><li><a href="#method.cartesian_product">cartesian_product</a></li><li><a href="#method.chunk_by">chunk_by</a></li><li><a href="#method.chunks">chunks</a></li><li><a href="#method.circular_tuple_windows">circular_tuple_windows</a></li><li><a href="#method.coalesce">coalesce</a></li><li><a href="#method.collect_tuple">collect_tuple</a></li><li><a href="#method.collect_vec">collect_vec</a></li><li><a href="#method.combinations">combinations</a></li><li><a href="#method.combinations_with_replacement">combinations_with_replacement</a></li><li><a href="#method.concat">concat</a></li><li><a href="#method.contains">contains</a></li><li><a href="#method.counts">counts</a></li><li><a href="#method.counts_by">counts_by</a></li><li><a href="#method.dedup">dedup</a></li><li><a href="#method.dedup_by">dedup_by</a></li><li><a href="#method.dedup_by_with_count">dedup_by_with_count</a></li><li><a href="#method.dedup_with_count">dedup_with_count</a></li><li><a href="#method.dropping">dropping</a></li><li><a href="#method.dropping_back">dropping_back</a></li><li><a href="#method.duplicates">duplicates</a></li><li><a href="#method.duplicates_by">duplicates_by</a></li><li><a href="#method.exactly_one">exactly_one</a></li><li><a href="#method.filter_map_ok">filter_map_ok</a></li><li><a href="#method.filter_ok">filter_ok</a></li><li><a href="#method.find_or_first">find_or_first</a></li><li><a href="#method.find_or_last">find_or_last</a></li><li><a href="#method.find_position">find_position</a></li><li><a href="#method.flatten_ok">flatten_ok</a></li><li><a href="#method.fold1">fold1</a></li><li><a href="#method.fold_ok">fold_ok</a></li><li><a href="#method.fold_options">fold_options</a></li><li><a href="#method.fold_while">fold_while</a></li><li><a href="#method.format">format</a></li><li><a href="#method.format_with">format_with</a></li><li><a href="#method.get">get</a></li><li><a href="#method.group_by">group_by</a></li><li><a href="#method.interleave">interleave</a></li><li><a href="#method.interleave_shortest">interleave_shortest</a></li><li><a href="#method.intersperse">intersperse</a></li><li><a href="#method.intersperse_with">intersperse_with</a></li><li><a href="#method.into_group_map">into_group_map</a></li><li><a href="#method.into_group_map_by">into_group_map_by</a></li><li><a href="#method.into_grouping_map">into_grouping_map</a></li><li><a href="#method.into_grouping_map_by">into_grouping_map_by</a></li><li><a href="#method.join">join</a></li><li><a href="#method.k_largest">k_largest</a></li><li><a href="#method.k_largest_by">k_largest_by</a></li><li><a href="#method.k_largest_by_key">k_largest_by_key</a></li><li><a href="#method.k_smallest">k_smallest</a></li><li><a href="#method.k_smallest_by">k_smallest_by</a></li><li><a href="#method.k_smallest_by_key">k_smallest_by_key</a></li><li><a href="#method.kmerge">kmerge</a></li><li><a href="#method.kmerge_by">kmerge_by</a></li><li><a href="#method.map_into">map_into</a></li><li><a href="#method.map_ok">map_ok</a></li><li><a href="#method.max_set">max_set</a></li><li><a href="#method.max_set_by">max_set_by</a></li><li><a href="#method.max_set_by_key">max_set_by_key</a></li><li><a href="#method.merge">merge</a></li><li><a href="#method.merge_by">merge_by</a></li><li><a href="#method.merge_join_by">merge_join_by</a></li><li><a href="#method.min_set">min_set</a></li><li><a href="#method.min_set_by">min_set_by</a></li><li><a href="#method.min_set_by_key">min_set_by_key</a></li><li><a href="#method.minmax">minmax</a></li><li><a href="#method.minmax_by">minmax_by</a></li><li><a href="#method.minmax_by_key">minmax_by_key</a></li><li><a href="#method.multi_cartesian_product">multi_cartesian_product</a></li><li><a href="#method.multipeek">multipeek</a></li><li><a href="#method.multiunzip">multiunzip</a></li><li><a href="#method.next_tuple">next_tuple</a></li><li><a href="#method.pad_using">pad_using</a></li><li><a href="#method.partition_map">partition_map</a></li><li><a href="#method.partition_result">partition_result</a></li><li><a href="#method.peeking_take_while">peeking_take_while</a></li><li><a href="#method.permutations">permutations</a></li><li><a href="#method.position_max">position_max</a></li><li><a href="#method.position_max_by">position_max_by</a></li><li><a href="#method.position_max_by_key">position_max_by_key</a></li><li><a href="#method.position_min">position_min</a></li><li><a href="#method.position_min_by">position_min_by</a></li><li><a href="#method.position_min_by_key">position_min_by_key</a></li><li><a href="#method.position_minmax">position_minmax</a></li><li><a href="#method.position_minmax_by">position_minmax_by</a></li><li><a href="#method.position_minmax_by_key">position_minmax_by_key</a></li><li><a href="#method.positions">positions</a></li><li><a href="#method.powerset">powerset</a></li><li><a href="#method.process_results">process_results</a></li><li><a href="#method.product1">product1</a></li><li><a href="#method.set_from">set_from</a></li><li><a href="#method.sorted">sorted</a></li><li><a href="#method.sorted_by">sorted_by</a></li><li><a href="#method.sorted_by_cached_key">sorted_by_cached_key</a></li><li><a href="#method.sorted_by_key">sorted_by_key</a></li><li><a href="#method.sorted_unstable">sorted_unstable</a></li><li><a href="#method.sorted_unstable_by">sorted_unstable_by</a></li><li><a href="#method.sorted_unstable_by_key">sorted_unstable_by_key</a></li><li><a href="#method.sum1">sum1</a></li><li><a href="#method.tail">tail</a></li><li><a href="#method.take_while_inclusive">take_while_inclusive</a></li><li><a href="#method.take_while_ref">take_while_ref</a></li><li><a href="#method.tee">tee</a></li><li><a href="#method.tree_fold1">tree_fold1</a></li><li><a href="#method.tree_reduce">tree_reduce</a></li><li><a href="#method.try_collect">try_collect</a></li><li><a href="#method.try_len">try_len</a></li><li><a href="#method.tuple_combinations">tuple_combinations</a></li><li><a href="#method.tuple_windows">tuple_windows</a></li><li><a href="#method.tuples">tuples</a></li><li><a href="#method.unique">unique</a></li><li><a href="#method.unique_by">unique_by</a></li><li><a href="#method.update">update</a></li><li><a href="#method.while_some">while_some</a></li><li><a href="#method.with_position">with_position</a></li><li><a href="#method.zip_eq">zip_eq</a></li><li><a href="#method.zip_longest">zip_longest</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In crate itertools</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="index.html">itertools</a>::<wbr><a class="trait" href="#">Itertools</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/itertools/lib.rs.html#425-4237">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 Itertools: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> {
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 121 methods</span></summary> // Provided methods
fn <a href="#method.interleave" class="fn">interleave</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.Interleave.html" title="struct itertools::structs::Interleave">Interleave</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="Interleave&lt;Self, J::IntoIter&gt;"></a>
<span class="where">where J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.interleave_shortest" class="fn">interleave_shortest</a>&lt;J&gt;(
self,
other: J,
) -&gt; <a class="struct" href="structs/struct.InterleaveShortest.html" title="struct itertools::structs::InterleaveShortest">InterleaveShortest</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="InterleaveShortest&lt;Self, J::IntoIter&gt;"></a>
<span class="where">where J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.intersperse" class="fn">intersperse</a>(self, element: Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="type" href="structs/type.Intersperse.html" title="type itertools::structs::Intersperse">Intersperse</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.intersperse_with" class="fn">intersperse_with</a>&lt;F&gt;(self, element: F) -&gt; <a class="struct" href="structs/struct.IntersperseWith.html" title="struct itertools::structs::IntersperseWith">IntersperseWith</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="IntersperseWith&lt;Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>() -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.get" class="fn">get</a>&lt;R&gt;(self, index: R) -&gt; R::<a class="associatedtype" href="traits/trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
R: <a class="trait" href="traits/trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;Self&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.zip_longest" class="fn">zip_longest</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.ZipLongest.html" title="struct itertools::structs::ZipLongest">ZipLongest</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="ZipLongest&lt;Self, J::IntoIter&gt;"></a>
<span class="where">where J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.zip_eq" class="fn">zip_eq</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.ZipEq.html" title="struct itertools::structs::ZipEq">ZipEq</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="ZipEq&lt;Self, J::IntoIter&gt;"></a>
<span class="where">where J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.batching" class="fn">batching</a>&lt;B, F&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.Batching.html" title="struct itertools::structs::Batching">Batching</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="Batching&lt;Self, F&gt;"></a>
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;mut Self</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.chunk_by" class="fn">chunk_by</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="structs/struct.ChunkBy.html" title="struct itertools::structs::ChunkBy">ChunkBy</a>&lt;K, Self, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.group_by" class="fn">group_by</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="structs/struct.ChunkBy.html" title="struct itertools::structs::ChunkBy">ChunkBy</a>&lt;K, Self, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.chunks" class="fn">chunks</a>(self, size: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="structs/struct.IntoChunks.html" title="struct itertools::structs::IntoChunks">IntoChunks</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tuple_windows" class="fn">tuple_windows</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.TupleWindows.html" title="struct itertools::structs::TupleWindows">TupleWindows</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="TupleWindows&lt;Self, T&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a>,
T::Item: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.circular_tuple_windows" class="fn">circular_tuple_windows</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.CircularTupleWindows.html" title="struct itertools::structs::CircularTupleWindows">CircularTupleWindows</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="CircularTupleWindows&lt;Self, T&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator">ExactSizeIterator</a>,
T: TupleCollect + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
T::Item: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tuples" class="fn">tuples</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.Tuples.html" title="struct itertools::structs::Tuples">Tuples</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="Tuples&lt;Self, T&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tee" class="fn">tee</a>(self) -&gt; (<a class="struct" href="structs/struct.Tee.html" title="struct itertools::structs::Tee">Tee</a>&lt;Self&gt;, <a class="struct" href="structs/struct.Tee.html" title="struct itertools::structs::Tee">Tee</a>&lt;Self&gt;)
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.map_into" class="fn">map_into</a>&lt;R&gt;(self) -&gt; <a class="type" href="structs/type.MapInto.html" title="type itertools::structs::MapInto">MapInto</a>&lt;Self, R&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;R&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.map_ok" class="fn">map_ok</a>&lt;F, T, U, E&gt;(self, f: F) -&gt; <a class="type" href="structs/type.MapOk.html" title="type itertools::structs::MapOk">MapOk</a>&lt;Self, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T) -&gt; U</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.filter_ok" class="fn">filter_ok</a>&lt;F, T, E&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.FilterOk.html" title="struct itertools::structs::FilterOk">FilterOk</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="FilterOk&lt;Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.filter_map_ok" class="fn">filter_map_ok</a>&lt;F, T, U, E&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.FilterMapOk.html" title="struct itertools::structs::FilterMapOk">FilterMapOk</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="FilterMapOk&lt;Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;U&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.flatten_ok" class="fn">flatten_ok</a>&lt;T, E&gt;(self) -&gt; <a class="struct" href="structs/struct.FlattenOk.html" title="struct itertools::structs::FlattenOk">FlattenOk</a>&lt;Self, T, E&gt; <a href="#" class="tooltip" data-notable-ty="FlattenOk&lt;Self, T, E&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.process_results" class="fn">process_results</a>&lt;F, T, E, R&gt;(self, processor: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, E&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="structs/struct.ProcessResults.html" title="struct itertools::structs::ProcessResults">ProcessResults</a>&lt;'_, Self, E&gt;) -&gt; R</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.merge" class="fn">merge</a>&lt;J&gt;(self, other: J) -&gt; <a class="type" href="structs/type.Merge.html" title="type itertools::structs::Merge">Merge</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.merge_by" class="fn">merge_by</a>&lt;J, F&gt;(
self,
other: J,
is_first: F,
) -&gt; <a class="struct" href="structs/struct.MergeBy.html" title="struct itertools::structs::MergeBy">MergeBy</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, F&gt; <a href="#" class="tooltip" data-notable-ty="MergeBy&lt;Self, J::IntoIter, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.merge_join_by" class="fn">merge_join_by</a>&lt;J, F, T&gt;(
self,
other: J,
cmp_fn: F,
) -&gt; <a class="type" href="structs/type.MergeJoinBy.html" title="type itertools::structs::MergeJoinBy">MergeJoinBy</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, F&gt;
<span class="where">where J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>) -&gt; T,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.kmerge" class="fn">kmerge</a>(self) -&gt; <a class="type" href="structs/type.KMerge.html" title="type itertools::structs::KMerge">KMerge</a>&lt;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.kmerge_by" class="fn">kmerge_by</a>&lt;F&gt;(
self,
first: F,
) -&gt; <a class="struct" href="structs/struct.KMergeBy.html" title="struct itertools::structs::KMergeBy">KMergeBy</a>&lt;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, F&gt; <a href="#" class="tooltip" data-notable-ty="KMergeBy&lt;&lt;Self::Item as IntoIterator&gt;::IntoIter, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>, &amp;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.cartesian_product" class="fn">cartesian_product</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.Product.html" title="struct itertools::structs::Product">Product</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="Product&lt;Self, J::IntoIter&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.multi_cartesian_product" class="fn">multi_cartesian_product</a>(
self,
) -&gt; <a class="struct" href="structs/struct.MultiProduct.html" title="struct itertools::structs::MultiProduct">MultiProduct</a>&lt;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="MultiProduct&lt;&lt;Self::Item as IntoIterator&gt;::IntoIter&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.coalesce" class="fn">coalesce</a>&lt;F&gt;(self, f: F) -&gt; <a class="type" href="structs/type.Coalesce.html" title="type itertools::structs::Coalesce">Coalesce</a>&lt;Self, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, (Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dedup" class="fn">dedup</a>(self) -&gt; <a class="type" href="structs/type.Dedup.html" title="type itertools::structs::Dedup">Dedup</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dedup_by" class="fn">dedup_by</a>&lt;Cmp&gt;(self, cmp: Cmp) -&gt; <a class="type" href="structs/type.DedupBy.html" title="type itertools::structs::DedupBy">DedupBy</a>&lt;Self, Cmp&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Cmp: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dedup_with_count" class="fn">dedup_with_count</a>(self) -&gt; <a class="type" href="structs/type.DedupWithCount.html" title="type itertools::structs::DedupWithCount">DedupWithCount</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dedup_by_with_count" class="fn">dedup_by_with_count</a>&lt;Cmp&gt;(self, cmp: Cmp) -&gt; <a class="type" href="structs/type.DedupByWithCount.html" title="type itertools::structs::DedupByWithCount">DedupByWithCount</a>&lt;Self, Cmp&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Cmp: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.duplicates" class="fn">duplicates</a>(self) -&gt; <a class="type" href="structs/type.Duplicates.html" title="type itertools::structs::Duplicates">Duplicates</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.duplicates_by" class="fn">duplicates_by</a>&lt;V, F&gt;(self, f: F) -&gt; <a class="type" href="structs/type.DuplicatesBy.html" title="type itertools::structs::DuplicatesBy">DuplicatesBy</a>&lt;Self, V, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
V: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; V</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.unique" class="fn">unique</a>(self) -&gt; <a class="struct" href="structs/struct.Unique.html" title="struct itertools::structs::Unique">Unique</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Unique&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.unique_by" class="fn">unique_by</a>&lt;V, F&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.UniqueBy.html" title="struct itertools::structs::UniqueBy">UniqueBy</a>&lt;Self, V, F&gt; <a href="#" class="tooltip" data-notable-ty="UniqueBy&lt;Self, V, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
V: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; V</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.peeking_take_while" class="fn">peeking_take_while</a>&lt;F&gt;(
&amp;mut self,
accept: F,
) -&gt; <a class="struct" href="structs/struct.PeekingTakeWhile.html" title="struct itertools::structs::PeekingTakeWhile">PeekingTakeWhile</a>&lt;'_, Self, F&gt; <a href="#" class="tooltip" data-notable-ty="PeekingTakeWhile&lt;&#39;_, Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.PeekingNext.html" title="trait itertools::PeekingNext">PeekingNext</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.take_while_ref" class="fn">take_while_ref</a>&lt;F&gt;(&amp;mut self, accept: F) -&gt; <a class="struct" href="structs/struct.TakeWhileRef.html" title="struct itertools::structs::TakeWhileRef">TakeWhileRef</a>&lt;'_, Self, F&gt; <a href="#" class="tooltip" data-notable-ty="TakeWhileRef&lt;&#39;_, Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.take_while_inclusive" class="fn">take_while_inclusive</a>&lt;F&gt;(self, accept: F) -&gt; <a class="struct" href="structs/struct.TakeWhileInclusive.html" title="struct itertools::structs::TakeWhileInclusive">TakeWhileInclusive</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="TakeWhileInclusive&lt;Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.while_some" class="fn">while_some</a>&lt;A&gt;(self) -&gt; <a class="struct" href="structs/struct.WhileSome.html" title="struct itertools::structs::WhileSome">WhileSome</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="WhileSome&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;A&gt;&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tuple_combinations" class="fn">tuple_combinations</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.TupleCombinations.html" title="struct itertools::structs::TupleCombinations">TupleCombinations</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="TupleCombinations&lt;Self, T&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
T: HasCombination&lt;Self&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.combinations" class="fn">combinations</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="structs/struct.Combinations.html" title="struct itertools::structs::Combinations">Combinations</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Combinations&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.combinations_with_replacement" class="fn">combinations_with_replacement</a>(
self,
k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>,
) -&gt; <a class="struct" href="structs/struct.CombinationsWithReplacement.html" title="struct itertools::structs::CombinationsWithReplacement">CombinationsWithReplacement</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="CombinationsWithReplacement&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.permutations" class="fn">permutations</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="structs/struct.Permutations.html" title="struct itertools::structs::Permutations">Permutations</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Permutations&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.powerset" class="fn">powerset</a>(self) -&gt; <a class="struct" href="structs/struct.Powerset.html" title="struct itertools::structs::Powerset">Powerset</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Powerset&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.pad_using" class="fn">pad_using</a>&lt;F&gt;(self, min: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="struct" href="structs/struct.PadUsing.html" title="struct itertools::structs::PadUsing">PadUsing</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="PadUsing&lt;Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.with_position" class="fn">with_position</a>(self) -&gt; <a class="struct" href="structs/struct.WithPosition.html" title="struct itertools::structs::WithPosition">WithPosition</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="WithPosition&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.positions" class="fn">positions</a>&lt;P&gt;(self, predicate: P) -&gt; <a class="struct" href="structs/struct.Positions.html" title="struct itertools::structs::Positions">Positions</a>&lt;Self, P&gt; <a href="#" class="tooltip" data-notable-ty="Positions&lt;Self, P&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.update" class="fn">update</a>&lt;F&gt;(self, updater: F) -&gt; <a class="struct" href="structs/struct.Update.html" title="struct itertools::structs::Update">Update</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="Update&lt;Self, F&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;mut Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.next_tuple" class="fn">next_tuple</a>&lt;T&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.collect_tuple" class="fn">collect_tuple</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.find_position" class="fn">find_position</a>&lt;P&gt;(&amp;mut self, pred: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)&gt;
<span class="where">where P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.find_or_last" class="fn">find_or_last</a>&lt;P&gt;(self, predicate: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.find_or_first" class="fn">find_or_first</a>&lt;P&gt;(self, predicate: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.contains" class="fn">contains</a>&lt;Q&gt;(&amp;mut self, query: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Q</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;Q&gt;,
Q: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.all_equal" class="fn">all_equal</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.all_equal_value" class="fn">all_equal_value</a>(
&amp;mut self,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.all_unique" class="fn">all_unique</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dropping" class="fn">dropping</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; Self
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.dropping_back" class="fn">dropping_back</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; Self
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator">DoubleEndedIterator</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.concat" class="fn">concat</a>(self) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;&lt;Self as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.collect_vec" class="fn">collect_vec</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.try_collect" class="fn">try_collect</a>&lt;T, U, E&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, E&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt;,
<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, E&gt;: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.set_from" class="fn">set_from</a>&lt;'a, A: 'a, J&gt;(&amp;mut self, from: J) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;'a mut A</a>&gt;,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = A&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.join" class="fn">join</a>(&amp;mut self, sep: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>
<span class="where">where Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.format" class="fn">format</a>(self, sep: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="structs/struct.Format.html" title="struct itertools::structs::Format">Format</a>&lt;'_, Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.format_with" class="fn">format_with</a>&lt;F&gt;(self, sep: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>, format: F) -&gt; <a class="struct" href="structs/struct.FormatWith.html" title="struct itertools::structs::FormatWith">FormatWith</a>&lt;'_, Self, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;mut dyn <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;dyn <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.80.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.80.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.fold_ok" class="fn">fold_ok</a>&lt;A, E, B, F&gt;(&amp;mut self, start: B, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;B, E&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;A, E&gt;&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, A) -&gt; B</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.fold_options" class="fn">fold_options</a>&lt;A, B, F&gt;(&amp;mut self, start: B, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;A&gt;&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, A) -&gt; B</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.fold1" class="fn">fold1</a>&lt;F&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tree_reduce" class="fn">tree_reduce</a>&lt;F&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tree_fold1" class="fn">tree_fold1</a>&lt;F&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.fold_while" class="fn">fold_while</a>&lt;B, F&gt;(&amp;mut self, init: B, f: F) -&gt; <a class="enum" href="enum.FoldWhile.html" title="enum itertools::FoldWhile">FoldWhile</a>&lt;B&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="enum.FoldWhile.html" title="enum itertools::FoldWhile">FoldWhile</a>&lt;B&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sum1" class="fn">sum1</a>&lt;S&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;S&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
S: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/accum/trait.Sum.html" title="trait core::iter::traits::accum::Sum">Sum</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.product1" class="fn">product1</a>&lt;P&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;P&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/accum/trait.Product.html" title="trait core::iter::traits::accum::Product">Product</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted_unstable" class="fn">sorted_unstable</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted_unstable_by" class="fn">sorted_unstable_by</a>&lt;F&gt;(self, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted_unstable_by_key" class="fn">sorted_unstable_by_key</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted" class="fn">sorted</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted_by" class="fn">sorted_by</a>&lt;F&gt;(self, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted_by_key" class="fn">sorted_by_key</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.sorted_by_cached_key" class="fn">sorted_by_cached_key</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.k_smallest" class="fn">k_smallest</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.k_smallest_by" class="fn">k_smallest_by</a>&lt;F&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.k_smallest_by_key" class="fn">k_smallest_by_key</a>&lt;F, K&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.k_largest" class="fn">k_largest</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.k_largest_by" class="fn">k_largest_by</a>&lt;F&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.k_largest_by_key" class="fn">k_largest_by_key</a>&lt;F, K&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.tail" class="fn">tail</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/collections/vec_deque/into_iter/struct.IntoIter.html" title="struct alloc::collections::vec_deque::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.partition_map" class="fn">partition_map</a>&lt;A, B, F, L, R&gt;(self, predicate: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="enum.Either.html" title="enum itertools::Either">Either</a>&lt;L, R&gt;,
A: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;L&gt;,
B: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;R&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.partition_result" class="fn">partition_result</a>&lt;A, B, T, E&gt;(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;T&gt;,
B: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;E&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.into_group_map" class="fn">into_group_map</a>&lt;K, V&gt;(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;V&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(K, V)</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.into_group_map_by" class="fn">into_group_map_by</a>&lt;K, V, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;V&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = V&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;V</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.into_grouping_map" class="fn">into_grouping_map</a>&lt;K, V&gt;(self) -&gt; <a class="struct" href="structs/struct.GroupingMap.html" title="struct itertools::structs::GroupingMap">GroupingMap</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(K, V)</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.into_grouping_map_by" class="fn">into_grouping_map_by</a>&lt;K, V, F&gt;(
self,
key_mapper: F,
) -&gt; <a class="type" href="structs/type.GroupingMapBy.html" title="type itertools::structs::GroupingMapBy">GroupingMapBy</a>&lt;Self, F&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = V&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;V</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.min_set" class="fn">min_set</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.min_set_by" class="fn">min_set_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.min_set_by_key" class="fn">min_set_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.max_set" class="fn">max_set</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.max_set_by" class="fn">max_set_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.max_set_by_key" class="fn">max_set_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.minmax" class="fn">minmax</a>(self) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.minmax_by_key" class="fn">minmax_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.minmax_by" class="fn">minmax_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_max" class="fn">position_max</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_max_by_key" class="fn">position_max_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_max_by" class="fn">position_max_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_min" class="fn">position_min</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_min_by_key" class="fn">position_min_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_min_by" class="fn">position_min_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_minmax" class="fn">position_minmax</a>(self) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_minmax_by_key" class="fn">position_minmax_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.position_minmax_by" class="fn">position_minmax_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.exactly_one" class="fn">exactly_one</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, <a class="struct" href="structs/struct.ExactlyOneError.html" title="struct itertools::structs::ExactlyOneError">ExactlyOneError</a>&lt;Self&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.at_most_one" class="fn">at_most_one</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;, <a class="struct" href="structs/struct.ExactlyOneError.html" title="struct itertools::structs::ExactlyOneError">ExactlyOneError</a>&lt;Self&gt;&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.multipeek" class="fn">multipeek</a>(self) -&gt; <a class="struct" href="structs/struct.MultiPeek.html" title="struct itertools::structs::MultiPeek">MultiPeek</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="MultiPeek&lt;Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.counts" class="fn">counts</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.counts_by" class="fn">counts_by</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.multiunzip" class="fn">multiunzip</a>&lt;FromI&gt;(self) -&gt; FromI
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.MultiUnzip.html" title="trait itertools::MultiUnzip">MultiUnzip</a>&lt;FromI&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.try_len" class="fn">try_len</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, (<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;)&gt; { ... }
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator"><code>Iterator</code></a> blanket implementation that provides extra adaptors and
methods.</p>
<p>This trait defines a number of methods. They are divided into two groups:</p>
<ul>
<li>
<p><em>Adaptors</em> take an iterator and parameter as input, and return
a new iterator value. These are listed first in the trait. An example
of an adaptor is <a href="trait.Itertools.html#method.interleave" title="method itertools::Itertools::interleave"><code>.interleave()</code></a></p>
</li>
<li>
<p><em>Regular methods</em> are those that dont return iterators and instead
return a regular value of some other kind.
<a href="trait.Itertools.html#method.next_tuple" title="method itertools::Itertools::next_tuple"><code>.next_tuple()</code></a> is an example and the first regular
method in the list.</p>
</li>
</ul>
</div></details><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.interleave" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#440-446">source</a><h4 class="code-header">fn <a href="#method.interleave" class="fn">interleave</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.Interleave.html" title="struct itertools::structs::Interleave">Interleave</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="Interleave&lt;Self, J::IntoIter&gt;"></a><div class="where">where
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Alternate elements from two iterators until both have run out.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">7</span>).interleave(<span class="macro">vec!</span>[-<span class="number">1</span>, -<span class="number">2</span>]);
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="number">1</span>, -<span class="number">1</span>, <span class="number">2</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>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.interleave_shortest" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#459-465">source</a><h4 class="code-header">fn <a href="#method.interleave_shortest" class="fn">interleave_shortest</a>&lt;J&gt;(
self,
other: J,
) -&gt; <a class="struct" href="structs/struct.InterleaveShortest.html" title="struct itertools::structs::InterleaveShortest">InterleaveShortest</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="InterleaveShortest&lt;Self, J::IntoIter&gt;"></a><div class="where">where
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Alternate elements from two iterators until at least one of them has run
out.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">7</span>).interleave_shortest(<span class="macro">vec!</span>[-<span class="number">1</span>, -<span class="number">2</span>]);
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="number">1</span>, -<span class="number">1</span>, <span class="number">2</span>, -<span class="number">2</span>, <span class="number">3</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.intersperse" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#479-485">source</a><h4 class="code-header">fn <a href="#method.intersperse" class="fn">intersperse</a>(self, element: Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="type" href="structs/type.Intersperse.html" title="type itertools::structs::Intersperse">Intersperse</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>An iterator adaptor to insert a particular value
between each element of the adapted iterator.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
itertools::assert_equal((<span class="number">0</span>..<span class="number">3</span>).intersperse(<span class="number">8</span>), <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">8</span>, <span class="number">1</span>, <span class="number">8</span>, <span class="number">2</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.intersperse_with" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#501-507">source</a><h4 class="code-header">fn <a href="#method.intersperse_with" class="fn">intersperse_with</a>&lt;F&gt;(self, element: F) -&gt; <a class="struct" href="structs/struct.IntersperseWith.html" title="struct itertools::structs::IntersperseWith">IntersperseWith</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="IntersperseWith&lt;Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>() -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,</div></h4></section></summary><div class="docblock"><p>An iterator adaptor to insert a particular value created by a function
between each element of the adapted iterator.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>i = <span class="number">10</span>;
itertools::assert_equal((<span class="number">0</span>..<span class="number">3</span>).intersperse_with(|| { i -= <span class="number">1</span>; i }), <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">8</span>, <span class="number">2</span>]);
<span class="macro">assert_eq!</span>(i, <span class="number">8</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#551-557">source</a><h4 class="code-header">fn <a href="#method.get" class="fn">get</a>&lt;R&gt;(self, index: R) -&gt; R::<a class="associatedtype" href="traits/trait.IteratorIndex.html#associatedtype.Output" title="type itertools::traits::IteratorIndex::Output">Output</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
R: <a class="trait" href="traits/trait.IteratorIndex.html" title="trait itertools::traits::IteratorIndex">IteratorIndex</a>&lt;Self&gt;,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over a subsection of the iterator.</p>
<p>Works similarly to <a href="https://doc.rust-lang.org/std/primitive.slice.html#method.get"><code>slice::get</code></a>.</p>
<p><strong>Panics</strong> for ranges <code>..=usize::MAX</code> and <code>0..=usize::MAX</code>.</p>
<p>Its a generalisation of <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.take" title="method core::iter::traits::iterator::Iterator::take"><code>Iterator::take</code></a> and <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.skip" title="method core::iter::traits::iterator::Iterator::skip"><code>Iterator::skip</code></a>,
and uses these under the hood.
Therefore, the resulting iterator is:</p>
<ul>
<li><a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator"><code>ExactSizeIterator</code></a> if the adapted iterator is <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator"><code>ExactSizeIterator</code></a>.</li>
<li><a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator"><code>DoubleEndedIterator</code></a> if the adapted iterator is <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator"><code>DoubleEndedIterator</code></a> and <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator"><code>ExactSizeIterator</code></a>.</li>
</ul>
<h5 id="unspecified-behavior"><a class="doc-anchor" href="#unspecified-behavior">§</a>Unspecified Behavior</h5>
<p>The result of indexing with an exhausted <a href="https://doc.rust-lang.org/1.80.0/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive"><code>core::ops::RangeInclusive</code></a> is unspecified.</p>
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>vec = <span class="macro">vec!</span>[<span class="number">3</span>, <span class="number">1</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="number">5</span>];
<span class="kw">let </span><span class="kw-2">mut </span>range: Vec&lt;<span class="kw">_</span>&gt; =
vec.iter().get(<span class="number">1</span>..=<span class="number">3</span>).copied().collect();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>range, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">4</span>, <span class="number">1</span>]);
<span class="comment">// It works with other types of ranges, too
</span>range = vec.iter().get(..<span class="number">2</span>).copied().collect();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>range, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">1</span>]);
range = vec.iter().get(<span class="number">0</span>..<span class="number">1</span>).copied().collect();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>range, <span class="kw-2">&amp;</span>[<span class="number">3</span>]);
range = vec.iter().get(<span class="number">2</span>..).copied().collect();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>range, <span class="kw-2">&amp;</span>[<span class="number">4</span>, <span class="number">1</span>, <span class="number">5</span>]);
range = vec.iter().get(..=<span class="number">2</span>).copied().collect();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>range, <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">1</span>, <span class="number">4</span>]);
range = vec.iter().get(..).copied().collect();
<span class="macro">assert_eq!</span>(range, vec);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.zip_longest" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#586-592">source</a><h4 class="code-header">fn <a href="#method.zip_longest" class="fn">zip_longest</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.ZipLongest.html" title="struct itertools::structs::ZipLongest">ZipLongest</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="ZipLongest&lt;Self, J::IntoIter&gt;"></a><div class="where">where
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Create an iterator which iterates over both this and the specified
iterator simultaneously, yielding pairs of two optional elements.</p>
<p>This iterator is <em>fused</em>.</p>
<p>As long as neither input iterator is exhausted yet, it yields two values
via <code>EitherOrBoth::Both</code>.</p>
<p>When the parameter iterator is exhausted, it only yields a value from the
<code>self</code> iterator via <code>EitherOrBoth::Left</code>.</p>
<p>When the <code>self</code> iterator is exhausted, it only yields a value from the
parameter iterator via <code>EitherOrBoth::Right</code>.</p>
<p>When both iterators return <code>None</code>, all further invocations of <code>.next()</code>
will return <code>None</code>.</p>
<p>Iterator element type is
<a href="enum.EitherOrBoth.html" title="enum itertools::EitherOrBoth"><code>EitherOrBoth&lt;Self::Item, J::Item&gt;</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::EitherOrBoth::{Both, Right};
<span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">1</span>).zip_longest(<span class="number">1</span>..<span class="number">3</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[Both(<span class="number">0</span>, <span class="number">1</span>), Right(<span class="number">2</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.zip_eq" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#600-606">source</a><h4 class="code-header">fn <a href="#method.zip_eq" class="fn">zip_eq</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.ZipEq.html" title="struct itertools::structs::ZipEq">ZipEq</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="ZipEq&lt;Self, J::IntoIter&gt;"></a><div class="where">where
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Create an iterator which iterates over both this and the specified
iterator simultaneously, yielding pairs of elements.</p>
<p><strong>Panics</strong> if the iterators reach an end and they are not of equal
lengths.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.batching" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#631-637">source</a><h4 class="code-header">fn <a href="#method.batching" class="fn">batching</a>&lt;B, F&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.Batching.html" title="struct itertools::structs::Batching">Batching</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="Batching&lt;Self, F&gt;"></a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;mut Self</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>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.</p>
<p>Iterator element type is <code>B</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// An adaptor that gathers elements in pairs
</span><span class="kw">let </span>pit = (<span class="number">0</span>..<span class="number">4</span>).batching(|it| {
<span class="kw">match </span>it.next() {
<span class="prelude-val">None </span>=&gt; <span class="prelude-val">None</span>,
<span class="prelude-val">Some</span>(x) =&gt; <span class="kw">match </span>it.next() {
<span class="prelude-val">None </span>=&gt; <span class="prelude-val">None</span>,
<span class="prelude-val">Some</span>(y) =&gt; <span class="prelude-val">Some</span>((x, y)),
}
}
});
itertools::assert_equal(pit, <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="number">1</span>), (<span class="number">2</span>, <span class="number">3</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.chunk_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#674-681">source</a><h4 class="code-header">fn <a href="#method.chunk_by" class="fn">chunk_by</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="structs/struct.ChunkBy.html" title="struct itertools::structs::ChunkBy">ChunkBy</a>&lt;K, Self, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Return an <em>iterable</em> that can group iterator elements.
Consecutive elements that map to the same key (“runs”), are assigned
to the same group.</p>
<p><code>ChunkBy</code> is the storage for the lazy grouping operation.</p>
<p>If the groups are consumed in order, or if each groups iterator is
dropped without keeping it around, then <code>ChunkBy</code> uses no
allocations. It needs allocations only if several group iterators
are alive at the same time.</p>
<p>This type implements <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator"><code>IntoIterator</code></a> (it is <strong>not</strong> an iterator
itself), because the group iterators need to borrow from this
value. It should be stored in a local variable or temporary and
iterated.</p>
<p>Iterator element type is <code>(K, Group)</code>: the groups key and the
group iterator.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// chunk data into runs of larger than zero or not.
</span><span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>, -<span class="number">2</span>, -<span class="number">2</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
<span class="comment">// chunks: |----&gt;|------&gt;|---------&gt;|
// Note: The `&amp;` is significant here, `ChunkBy` is iterable
// only by reference. You can also call `.into_iter()` explicitly.
</span><span class="kw">let </span><span class="kw-2">mut </span>data_grouped = Vec::new();
<span class="kw">for </span>(key, chunk) <span class="kw">in </span><span class="kw-2">&amp;</span>data.into_iter().chunk_by(|elt| <span class="kw-2">*</span>elt &gt;= <span class="number">0</span>) {
data_grouped.push((key, chunk.collect()));
}
<span class="macro">assert_eq!</span>(data_grouped, <span class="macro">vec!</span>[(<span class="bool-val">true</span>, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>]), (<span class="bool-val">false</span>, <span class="macro">vec!</span>[-<span class="number">2</span>, -<span class="number">2</span>]), (<span class="bool-val">true</span>, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>])]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.group_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#686-693">source</a><h4 class="code-header">fn <a href="#method.group_by" class="fn">group_by</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="structs/struct.ChunkBy.html" title="struct itertools::structs::ChunkBy">ChunkBy</a>&lt;K, Self, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.13.0: Use .chunk_by() instead</span></div></span></summary><div class="docblock"><p>See <a href="trait.Itertools.html#method.chunk_by" title="method itertools::Itertools::chunk_by"><code>.chunk_by()</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.chunks" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#723-729">source</a><h4 class="code-header">fn <a href="#method.chunks" class="fn">chunks</a>(self, size: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="structs/struct.IntoChunks.html" title="struct itertools::structs::IntoChunks">IntoChunks</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Return an <em>iterable</em> that can chunk the iterator.</p>
<p>Yield subiterators (chunks) that each yield a fixed number elements,
determined by <code>size</code>. The last chunk will be shorter if there arent
enough elements.</p>
<p><code>IntoChunks</code> is based on <code>ChunkBy</code>: it is iterable (implements
<code>IntoIterator</code>, <strong>not</strong> <code>Iterator</code>), and it only buffers if several
chunk iterators are alive at the same time.</p>
<p>Iterator element type is <code>Chunk</code>, each chunks iterator.</p>
<p><strong>Panics</strong> if <code>size</code> is 0.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, -<span class="number">2</span>, <span class="number">6</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">1</span>];
<span class="comment">//chunk size=3 |-------&gt;|--------&gt;|---&gt;|
// Note: The `&amp;` is significant here, `IntoChunks` is iterable
// only by reference. You can also call `.into_iter()` explicitly.
</span><span class="kw">for </span>chunk <span class="kw">in </span><span class="kw-2">&amp;</span>data.into_iter().chunks(<span class="number">3</span>) {
<span class="comment">// Check that the sum of each chunk is 4.
</span><span class="macro">assert_eq!</span>(<span class="number">4</span>, chunk.sum());
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tuple_windows" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#764-771">source</a><h4 class="code-header">fn <a href="#method.tuple_windows" class="fn">tuple_windows</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.TupleWindows.html" title="struct itertools::structs::TupleWindows">TupleWindows</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="TupleWindows&lt;Self, T&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a>,
T::Item: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator over all contiguous windows producing tuples of
a specific size (up to 12).</p>
<p><code>tuple_windows</code> clones the iterator elements so that they can be
part of successive windows, this makes it most suited for iterators
of references and other values that are cheap to copy.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>v = Vec::new();
<span class="comment">// pairwise iteration
</span><span class="kw">for </span>(a, b) <span class="kw">in </span>(<span class="number">1</span>..<span class="number">5</span>).tuple_windows() {
v.push((a, b));
}
<span class="macro">assert_eq!</span>(v, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">3</span>), (<span class="number">3</span>, <span class="number">4</span>)]);
<span class="kw">let </span><span class="kw-2">mut </span>it = (<span class="number">1</span>..<span class="number">5</span>).tuple_windows();
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());
<span class="comment">// this requires a type hint
</span><span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">5</span>).tuple_windows::&lt;(<span class="kw">_</span>, <span class="kw">_</span>, <span class="kw">_</span>)&gt;();
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>), (<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)]);
<span class="comment">// you can also specify the complete type
</span><span class="kw">use </span>itertools::TupleWindows;
<span class="kw">use </span>std::ops::Range;
<span class="kw">let </span>it: TupleWindows&lt;Range&lt;u32&gt;, (u32, u32, u32)&gt; = (<span class="number">1</span>..<span class="number">5</span>).tuple_windows();
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>), (<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.circular_tuple_windows" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#800-807">source</a><h4 class="code-header">fn <a href="#method.circular_tuple_windows" class="fn">circular_tuple_windows</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.CircularTupleWindows.html" title="struct itertools::structs::CircularTupleWindows">CircularTupleWindows</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="CircularTupleWindows&lt;Self, T&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator">ExactSizeIterator</a>,
T: TupleCollect + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
T::Item: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return 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 (up to 12).</p>
<p><code>circular_tuple_windows</code> clones the iterator elements so that they can be
part of successive windows, this makes it most suited for iterators
of references and other values that are cheap to copy.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>v = Vec::new();
<span class="kw">for </span>(a, b) <span class="kw">in </span>(<span class="number">1</span>..<span class="number">5</span>).circular_tuple_windows() {
v.push((a, b));
}
<span class="macro">assert_eq!</span>(v, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">3</span>), (<span class="number">3</span>, <span class="number">4</span>), (<span class="number">4</span>, <span class="number">1</span>)]);
<span class="kw">let </span><span class="kw-2">mut </span>it = (<span class="number">1</span>..<span class="number">5</span>).circular_tuple_windows();
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">3</span>, <span class="number">4</span>, <span class="number">1</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">4</span>, <span class="number">1</span>, <span class="number">2</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());
<span class="comment">// this requires a type hint
</span><span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">5</span>).circular_tuple_windows::&lt;(<span class="kw">_</span>, <span class="kw">_</span>, <span class="kw">_</span>)&gt;();
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>), (<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>), (<span class="number">3</span>, <span class="number">4</span>, <span class="number">1</span>), (<span class="number">4</span>, <span class="number">1</span>, <span class="number">2</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tuples" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#839-845">source</a><h4 class="code-header">fn <a href="#method.tuples" class="fn">tuples</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.Tuples.html" title="struct itertools::structs::Tuples">Tuples</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="Tuples&lt;Self, T&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator that groups the items in tuples of a specific size
(up to 12).</p>
<p>See also the method <a href="trait.Itertools.html#method.next_tuple" title="method itertools::Itertools::next_tuple"><code>.next_tuple()</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>v = Vec::new();
<span class="kw">for </span>(a, b) <span class="kw">in </span>(<span class="number">1</span>..<span class="number">5</span>).tuples() {
v.push((a, b));
}
<span class="macro">assert_eq!</span>(v, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">3</span>, <span class="number">4</span>)]);
<span class="kw">let </span><span class="kw-2">mut </span>it = (<span class="number">1</span>..<span class="number">7</span>).tuples();
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());
<span class="comment">// this requires a type hint
</span><span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">7</span>).tuples::&lt;(<span class="kw">_</span>, <span class="kw">_</span>, <span class="kw">_</span>)&gt;();
itertools::assert_equal(it, <span class="macro">vec!</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">// you can also specify the complete type
</span><span class="kw">use </span>itertools::Tuples;
<span class="kw">use </span>std::ops::Range;
<span class="kw">let </span>it: Tuples&lt;Range&lt;u32&gt;, (u32, u32, u32)&gt; = (<span class="number">1</span>..<span class="number">7</span>).tuples();
itertools::assert_equal(it, <span class="macro">vec!</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>)]);</code></pre></div>
<p>See also <a href="structs/struct.Tuples.html#method.into_buffer" title="method itertools::structs::Tuples::into_buffer"><code>Tuples::into_buffer</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tee" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#865-871">source</a><h4 class="code-header">fn <a href="#method.tee" class="fn">tee</a>(self) -&gt; (<a class="struct" href="structs/struct.Tee.html" title="struct itertools::structs::Tee">Tee</a>&lt;Self&gt;, <a class="struct" href="structs/struct.Tee.html" title="struct itertools::structs::Tee">Tee</a>&lt;Self&gt;)<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Split into an iterator pair that both yield all elements from
the original iterator.</p>
<p><strong>Note:</strong> If the iterator is clonable, prefer using that instead
of using this method. Cloning is likely to be more efficient.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>xs = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let </span>(<span class="kw-2">mut </span>t1, t2) = xs.into_iter().tee();
itertools::assert_equal(t1.next(), <span class="prelude-val">Some</span>(<span class="number">0</span>));
itertools::assert_equal(t2, <span class="number">0</span>..<span class="number">4</span>);
itertools::assert_equal(t1, <span class="number">1</span>..<span class="number">4</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.map_into" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#880-886">source</a><h4 class="code-header">fn <a href="#method.map_into" class="fn">map_into</a>&lt;R&gt;(self) -&gt; <a class="type" href="structs/type.MapInto.html" title="type itertools::structs::MapInto">MapInto</a>&lt;Self, R&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;R&gt;,</div></h4></section></summary><div class="docblock"><p>Convert each item of the iterator using the <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into"><code>Into</code></a> trait.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
(<span class="number">1i32</span>..<span class="number">42i32</span>).map_into::&lt;f64&gt;().collect_vec();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.map_ok" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#899-905">source</a><h4 class="code-header">fn <a href="#method.map_ok" class="fn">map_ok</a>&lt;F, T, U, E&gt;(self, f: F) -&gt; <a class="type" href="structs/type.MapOk.html" title="type itertools::structs::MapOk">MapOk</a>&lt;Self, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T) -&gt; U,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that applies the provided closure
to every <code>Result::Ok</code> value. <code>Result::Err</code> values are
unchanged.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>input = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">41</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Ok</span>(<span class="number">11</span>)];
<span class="kw">let </span>it = input.into_iter().map_ok(|i| i + <span class="number">1</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">42</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Ok</span>(<span class="number">12</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.filter_ok" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#918-924">source</a><h4 class="code-header">fn <a href="#method.filter_ok" class="fn">filter_ok</a>&lt;F, T, E&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.FilterOk.html" title="struct itertools::structs::FilterOk">FilterOk</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="FilterOk&lt;Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that filters every <code>Result::Ok</code>
value with the provided closure. <code>Result::Err</code> values are
unchanged.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>input = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">22</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Ok</span>(<span class="number">11</span>)];
<span class="kw">let </span>it = input.into_iter().filter_ok(|<span class="kw-2">&amp;</span>i| i &gt; <span class="number">20</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">22</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.filter_map_ok" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#937-943">source</a><h4 class="code-header">fn <a href="#method.filter_map_ok" class="fn">filter_map_ok</a>&lt;F, T, U, E&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.FilterMapOk.html" title="struct itertools::structs::FilterMapOk">FilterMapOk</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="FilterMapOk&lt;Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;U&gt;,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that filters and transforms every
<code>Result::Ok</code> value with the provided closure. <code>Result::Err</code>
values are unchanged.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>input = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">22</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Ok</span>(<span class="number">11</span>)];
<span class="kw">let </span>it = input.into_iter().filter_map_ok(|i| <span class="kw">if </span>i &gt; <span class="number">20 </span>{ <span class="prelude-val">Some</span>(i * <span class="number">2</span>) } <span class="kw">else </span>{ <span class="prelude-val">None </span>});
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">44</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.flatten_ok" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#962-968">source</a><h4 class="code-header">fn <a href="#method.flatten_ok" class="fn">flatten_ok</a>&lt;T, E&gt;(self) -&gt; <a class="struct" href="structs/struct.FlattenOk.html" title="struct itertools::structs::FlattenOk">FlattenOk</a>&lt;Self, T, E&gt; <a href="#" class="tooltip" data-notable-ty="FlattenOk&lt;Self, T, E&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that flattens every <code>Result::Ok</code> value into
a series of <code>Result::Ok</code> values. <code>Result::Err</code> values are unchanged.</p>
<p>This is useful when you have some common error type for your crate and
need to propagate it upwards, but the <code>Result::Ok</code> case needs to be flattened.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>input = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">0</span>..<span class="number">2</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Ok</span>(<span class="number">2</span>..<span class="number">4</span>)];
<span class="kw">let </span>it = input.iter().cloned().flatten_ok();
itertools::assert_equal(it.clone(), <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">0</span>), <span class="prelude-val">Ok</span>(<span class="number">1</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Ok</span>(<span class="number">2</span>), <span class="prelude-val">Ok</span>(<span class="number">3</span>)]);
<span class="comment">// This can also be used to propagate errors when collecting.
</span><span class="kw">let </span>output_result: <span class="prelude-ty">Result</span>&lt;Vec&lt;i32&gt;, bool&gt; = it.collect();
<span class="macro">assert_eq!</span>(output_result, <span class="prelude-val">Err</span>(<span class="bool-val">false</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.process_results" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1000-1006">source</a><h4 class="code-header">fn <a href="#method.process_results" class="fn">process_results</a>&lt;F, T, E, R&gt;(self, processor: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, E&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="structs/struct.ProcessResults.html" title="struct itertools::structs::ProcessResults">ProcessResults</a>&lt;'_, Self, E&gt;) -&gt; R,</div></h4></section></summary><div class="docblock"><p>“Lift” a function of the values of the current iterator so as to process
an iterator of <code>Result</code> values instead.</p>
<p><code>processor</code> is a closure that receives an adapted version of the iterator
as the only argument — the adapted iterator produces elements of type <code>T</code>,
as long as the original iterator produces <code>Ok</code> values.</p>
<p>If the original iterable produces an error at any point, the adapted
iterator ends and it will return the error iself.</p>
<p>Otherwise, the return value from the closure is returned wrapped
inside <code>Ok</code>.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">type </span>Item = <span class="prelude-ty">Result</span>&lt;i32, <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str&gt;;
<span class="kw">let </span>first_values: Vec&lt;Item&gt; = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">1</span>), <span class="prelude-val">Ok</span>(<span class="number">0</span>), <span class="prelude-val">Ok</span>(<span class="number">3</span>)];
<span class="kw">let </span>second_values: Vec&lt;Item&gt; = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">2</span>), <span class="prelude-val">Ok</span>(<span class="number">1</span>), <span class="prelude-val">Err</span>(<span class="string">"overflow"</span>)];
<span class="comment">// “Lift” the iterator .max() method to work on the Ok-values.
</span><span class="kw">let </span>first_max = first_values.into_iter().process_results(|iter| iter.max().unwrap_or(<span class="number">0</span>));
<span class="kw">let </span>second_max = second_values.into_iter().process_results(|iter| iter.max().unwrap_or(<span class="number">0</span>));
<span class="macro">assert_eq!</span>(first_max, <span class="prelude-val">Ok</span>(<span class="number">3</span>));
<span class="macro">assert!</span>(second_max.is_err());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.merge" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1022-1029">source</a><h4 class="code-header">fn <a href="#method.merge" class="fn">merge</a>&lt;J&gt;(self, other: J) -&gt; <a class="type" href="structs/type.Merge.html" title="type itertools::structs::Merge">Merge</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that merges the two base iterators in
ascending order. If both base iterators are sorted (ascending), the
result is sorted.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a = (<span class="number">0</span>..<span class="number">11</span>).step_by(<span class="number">3</span>);
<span class="kw">let </span>b = (<span class="number">0</span>..<span class="number">11</span>).step_by(<span class="number">5</span>);
<span class="kw">let </span>it = a.merge(b);
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">9</span>, <span class="number">10</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.merge_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1047-1054">source</a><h4 class="code-header">fn <a href="#method.merge_by" class="fn">merge_by</a>&lt;J, F&gt;(self, other: J, is_first: F) -&gt; <a class="struct" href="structs/struct.MergeBy.html" title="struct itertools::structs::MergeBy">MergeBy</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, F&gt; <a href="#" class="tooltip" data-notable-ty="MergeBy&lt;Self, J::IntoIter, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that merges the two base iterators in order.
This is much like <a href="trait.Itertools.html#method.merge" title="method itertools::Itertools::merge"><code>.merge()</code></a> but allows for a custom ordering.</p>
<p>This can be especially useful for sequences of tuples.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a = (<span class="number">0</span>..).zip(<span class="string">"bc"</span>.chars());
<span class="kw">let </span>b = (<span class="number">0</span>..).zip(<span class="string">"ad"</span>.chars());
<span class="kw">let </span>it = a.merge_by(b, |x, y| x.<span class="number">1 </span>&lt;= y.<span class="number">1</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="string">'a'</span>), (<span class="number">0</span>, <span class="string">'b'</span>), (<span class="number">1</span>, <span class="string">'c'</span>), (<span class="number">1</span>, <span class="string">'d'</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.merge_join_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1114-1121">source</a><h4 class="code-header">fn <a href="#method.merge_join_by" class="fn">merge_join_by</a>&lt;J, F, T&gt;(
self,
other: J,
cmp_fn: F,
) -&gt; <a class="type" href="structs/type.MergeJoinBy.html" title="type itertools::structs::MergeJoinBy">MergeJoinBy</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, F&gt;<div class="where">where
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>) -&gt; T,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Create an iterator that merges items from both this and the specified
iterator in ascending order.</p>
<p>The function can either return an <code>Ordering</code> variant or a boolean.</p>
<p>If <code>cmp_fn</code> returns <code>Ordering</code>,
it chooses whether to pair elements based on the <code>Ordering</code> returned by the
specified compare function. At any point, inspecting the tip of the
iterators <code>I</code> and <code>J</code> as items <code>i</code> of type <code>I::Item</code> and <code>j</code> of type
<code>J::Item</code> respectively, the resulting iterator will:</p>
<ul>
<li>Emit <code>EitherOrBoth::Left(i)</code> when <code>i &lt; j</code>,
and remove <code>i</code> from its source iterator</li>
<li>Emit <code>EitherOrBoth::Right(j)</code> when <code>i &gt; j</code>,
and remove <code>j</code> from its source iterator</li>
<li>Emit <code>EitherOrBoth::Both(i, j)</code> when <code>i == j</code>,
and remove both <code>i</code> and <code>j</code> from their respective source iterators</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::EitherOrBoth::{Left, Right, Both};
<span class="kw">let </span>a = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">1</span>].into_iter();
<span class="kw">let </span>b = (<span class="number">0</span>..<span class="number">10</span>).step_by(<span class="number">3</span>);
itertools::assert_equal(
a.merge_join_by(b, |i, j| i.cmp(j)),
<span class="macro">vec!</span>[Both(<span class="number">0</span>, <span class="number">0</span>), Left(<span class="number">2</span>), Right(<span class="number">3</span>), Left(<span class="number">4</span>), Both(<span class="number">6</span>, <span class="number">6</span>), Left(<span class="number">1</span>), Right(<span class="number">9</span>)]
);</code></pre></div>
<p>If <code>cmp_fn</code> returns <code>bool</code>,
it chooses whether to pair elements based on the boolean returned by the
specified function. At any point, inspecting the tip of the
iterators <code>I</code> and <code>J</code> as items <code>i</code> of type <code>I::Item</code> and <code>j</code> of type
<code>J::Item</code> respectively, the resulting iterator will:</p>
<ul>
<li>Emit <code>Either::Left(i)</code> when <code>true</code>,
and remove <code>i</code> from its source iterator</li>
<li>Emit <code>Either::Right(j)</code> when <code>false</code>,
and remove <code>j</code> from its source iterator</li>
</ul>
<p>It is similar to the <code>Ordering</code> case if the first argument is considered
“less” than the second argument.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::Either::{Left, Right};
<span class="kw">let </span>a = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">1</span>].into_iter();
<span class="kw">let </span>b = (<span class="number">0</span>..<span class="number">10</span>).step_by(<span class="number">3</span>);
itertools::assert_equal(
a.merge_join_by(b, |i, j| i &lt;= j),
<span class="macro">vec!</span>[Left(<span class="number">0</span>), Right(<span class="number">0</span>), Left(<span class="number">2</span>), Right(<span class="number">3</span>), Left(<span class="number">4</span>), Left(<span class="number">6</span>), Left(<span class="number">1</span>), Right(<span class="number">6</span>), Right(<span class="number">9</span>)]
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.kmerge" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1140-1147">source</a><h4 class="code-header">fn <a href="#method.kmerge" class="fn">kmerge</a>(self) -&gt; <a class="type" href="structs/type.KMerge.html" title="type itertools::structs::KMerge">KMerge</a>&lt;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that flattens an iterator of iterators by
merging them in ascending order.</p>
<p>If all base iterators are sorted (ascending), the result is sorted.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a = (<span class="number">0</span>..<span class="number">6</span>).step_by(<span class="number">3</span>);
<span class="kw">let </span>b = (<span class="number">1</span>..<span class="number">6</span>).step_by(<span class="number">3</span>);
<span class="kw">let </span>c = (<span class="number">2</span>..<span class="number">6</span>).step_by(<span class="number">3</span>);
<span class="kw">let </span>it = <span class="macro">vec!</span>[a, b, c].into_iter().kmerge();
itertools::assert_equal(it, <span class="macro">vec!</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>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.kmerge_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1170-1177">source</a><h4 class="code-header">fn <a href="#method.kmerge_by" class="fn">kmerge_by</a>&lt;F&gt;(
self,
first: F,
) -&gt; <a class="struct" href="structs/struct.KMergeBy.html" title="struct itertools::structs::KMergeBy">KMergeBy</a>&lt;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, F&gt; <a href="#" class="tooltip" data-notable-ty="KMergeBy&lt;&lt;Self::Item as IntoIterator&gt;::IntoIter, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>, &amp;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that flattens an iterator of iterators by
merging them according to the given closure.</p>
<p>The closure <code>first</code> is called with two elements <em>a</em>, <em>b</em> and should
return <code>true</code> if <em>a</em> is ordered before <em>b</em>.</p>
<p>If all base iterators are sorted according to <code>first</code>, the result is
sorted.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a = <span class="macro">vec!</span>[-<span class="number">1f64</span>, <span class="number">2.</span>, <span class="number">3.</span>, -<span class="number">5.</span>, <span class="number">6.</span>, -<span class="number">7.</span>];
<span class="kw">let </span>b = <span class="macro">vec!</span>[<span class="number">0.</span>, <span class="number">2.</span>, -<span class="number">4.</span>];
<span class="kw">let </span><span class="kw-2">mut </span>it = <span class="macro">vec!</span>[a, b].into_iter().kmerge_by(|a, b| a.abs() &lt; b.abs());
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">Some</span>(<span class="number">0.</span>));
<span class="macro">assert_eq!</span>(it.last(), <span class="prelude-val">Some</span>(-<span class="number">7.</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.cartesian_product" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1190-1198">source</a><h4 class="code-header">fn <a href="#method.cartesian_product" class="fn">cartesian_product</a>&lt;J&gt;(self, other: J) -&gt; <a class="struct" href="structs/struct.Product.html" title="struct itertools::structs::Product">Product</a>&lt;Self, J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="Product&lt;Self, J::IntoIter&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
J::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that iterates over the cartesian product of
the element sets of two iterators <code>self</code> and <code>J</code>.</p>
<p>Iterator element type is <code>(Self::Item, J::Item)</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">2</span>).cartesian_product(<span class="string">"αβ"</span>.chars());
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="string">'α'</span>), (<span class="number">0</span>, <span class="string">'β'</span>), (<span class="number">1</span>, <span class="string">'α'</span>), (<span class="number">1</span>, <span class="string">'β'</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.multi_cartesian_product" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1237-1245">source</a><h4 class="code-header">fn <a href="#method.multi_cartesian_product" class="fn">multi_cartesian_product</a>(
self,
) -&gt; <a class="struct" href="structs/struct.MultiProduct.html" title="struct itertools::structs::MultiProduct">MultiProduct</a>&lt;&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt; <a href="#" class="tooltip" data-notable-ty="MultiProduct&lt;&lt;Self::Item as IntoIterator&gt;::IntoIter&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that iterates over the cartesian product of
all subiterators returned by meta-iterator <code>self</code>.</p>
<p>All provided iterators must yield the same <code>Item</code> type. To generate
the product of iterators yielding multiple types, use the
<a href="macro.iproduct.html" title="macro itertools::iproduct"><code>iproduct</code></a> macro instead.</p>
<p>The iterator element type is <code>Vec&lt;T&gt;</code>, where <code>T</code> is the iterator element
of the subiterators.</p>
<p>Note that the iterator is fused.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>multi_prod = (<span class="number">0</span>..<span class="number">3</span>).map(|i| (i * <span class="number">2</span>)..(i * <span class="number">2 </span>+ <span class="number">2</span>))
.multi_cartesian_product();
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">2</span>, <span class="number">4</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">2</span>, <span class="number">5</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">3</span>, <span class="number">5</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">5</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">4</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">5</span>]));
<span class="macro">assert_eq!</span>(multi_prod.next(), <span class="prelude-val">None</span>);</code></pre></div>
<p>If the adapted iterator is empty, the result is an iterator yielding a single empty vector.
This is known as the <a href="https://en.wikipedia.org/wiki/Empty_product#Nullary_Cartesian_product">nullary cartesian product</a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>nullary_cartesian_product = (<span class="number">0</span>..<span class="number">0</span>).map(|i| (i * <span class="number">2</span>)..(i * <span class="number">2 </span>+ <span class="number">2</span>)).multi_cartesian_product();
<span class="macro">assert_eq!</span>(nullary_cartesian_product.next(), <span class="prelude-val">Some</span>(<span class="macro">vec!</span>[]));
<span class="macro">assert_eq!</span>(nullary_cartesian_product.next(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.coalesce" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1275-1281">source</a><h4 class="code-header">fn <a href="#method.coalesce" class="fn">coalesce</a>&lt;F&gt;(self, f: F) -&gt; <a class="type" href="structs/type.Coalesce.html" title="type itertools::structs::Coalesce">Coalesce</a>&lt;Self, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, (Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)&gt;,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that uses the passed-in closure to
optionally merge together consecutive elements.</p>
<p>The closure <code>f</code> is passed two elements, <code>previous</code> and <code>current</code> and may
return either (1) <code>Ok(combined)</code> to merge the two values or
(2) <code>Err((previous', current'))</code> to indicate they cant be merged.
In (2), the value <code>previous'</code> is emitted by the iterator.
Either (1) <code>combined</code> or (2) <code>current'</code> becomes the previous value
when coalesce continues with the next pair of elements to merge. The
value that remains at the end is also emitted by the iterator.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sum same-sign runs together
</span><span class="kw">let </span>data = <span class="macro">vec!</span>[-<span class="number">1.</span>, -<span class="number">2.</span>, -<span class="number">3.</span>, <span class="number">3.</span>, <span class="number">1.</span>, <span class="number">0.</span>, -<span class="number">1.</span>];
itertools::assert_equal(data.into_iter().coalesce(|x, y|
<span class="kw">if </span>(x &gt;= <span class="number">0.</span>) == (y &gt;= <span class="number">0.</span>) {
<span class="prelude-val">Ok</span>(x + y)
} <span class="kw">else </span>{
<span class="prelude-val">Err</span>((x, y))
}),
<span class="macro">vec!</span>[-<span class="number">6.</span>, <span class="number">4.</span>, -<span class="number">1.</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dedup" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1297-1303">source</a><h4 class="code-header">fn <a href="#method.dedup" class="fn">dedup</a>(self) -&gt; <a class="type" href="structs/type.Dedup.html" title="type itertools::structs::Dedup">Dedup</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Remove duplicates from sections of consecutive identical elements.
If the iterator is sorted, all elements will be unique.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1.</span>, <span class="number">1.</span>, <span class="number">2.</span>, <span class="number">3.</span>, <span class="number">3.</span>, <span class="number">2.</span>, <span class="number">2.</span>];
itertools::assert_equal(data.into_iter().dedup(),
<span class="macro">vec!</span>[<span class="number">1.</span>, <span class="number">2.</span>, <span class="number">3.</span>, <span class="number">2.</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dedup_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1320-1326">source</a><h4 class="code-header">fn <a href="#method.dedup_by" class="fn">dedup_by</a>&lt;Cmp&gt;(self, cmp: Cmp) -&gt; <a class="type" href="structs/type.DedupBy.html" title="type itertools::structs::DedupBy">DedupBy</a>&lt;Self, Cmp&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Cmp: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Remove duplicates from sections of consecutive identical elements,
determining equality using a comparison function.
If the iterator is sorted, all elements will be unique.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="number">1.</span>), (<span class="number">1</span>, <span class="number">1.</span>), (<span class="number">0</span>, <span class="number">2.</span>), (<span class="number">0</span>, <span class="number">3.</span>), (<span class="number">1</span>, <span class="number">3.</span>), (<span class="number">1</span>, <span class="number">2.</span>), (<span class="number">2</span>, <span class="number">2.</span>)];
itertools::assert_equal(data.into_iter().dedup_by(|x, y| x.<span class="number">1 </span>== y.<span class="number">1</span>),
<span class="macro">vec!</span>[(<span class="number">0</span>, <span class="number">1.</span>), (<span class="number">0</span>, <span class="number">2.</span>), (<span class="number">0</span>, <span class="number">3.</span>), (<span class="number">1</span>, <span class="number">2.</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dedup_with_count" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1343-1348">source</a><h4 class="code-header">fn <a href="#method.dedup_with_count" class="fn">dedup_with_count</a>(self) -&gt; <a class="type" href="structs/type.DedupWithCount.html" title="type itertools::structs::DedupWithCount">DedupWithCount</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Remove duplicates from sections of consecutive identical elements, while keeping a count of
how many repeated elements were present.
If the iterator is sorted, all elements will be unique.</p>
<p>Iterator element type is <code>(usize, Self::Item)</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="string">'a'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'c'</span>, <span class="string">'b'</span>, <span class="string">'b'</span>];
itertools::assert_equal(data.into_iter().dedup_with_count(),
<span class="macro">vec!</span>[(<span class="number">2</span>, <span class="string">'a'</span>), (<span class="number">1</span>, <span class="string">'b'</span>), (<span class="number">2</span>, <span class="string">'c'</span>), (<span class="number">2</span>, <span class="string">'b'</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dedup_by_with_count" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1366-1372">source</a><h4 class="code-header">fn <a href="#method.dedup_by_with_count" class="fn">dedup_by_with_count</a>&lt;Cmp&gt;(self, cmp: Cmp) -&gt; <a class="type" href="structs/type.DedupByWithCount.html" title="type itertools::structs::DedupByWithCount">DedupByWithCount</a>&lt;Self, Cmp&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Cmp: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Remove duplicates from sections of consecutive identical elements, while keeping a count of
how many repeated elements were present.
This will determine equality using a comparison function.
If the iterator is sorted, all elements will be unique.</p>
<p>Iterator element type is <code>(usize, Self::Item)</code>.</p>
<p>This iterator is <em>fused</em>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="string">'a'</span>), (<span class="number">1</span>, <span class="string">'a'</span>), (<span class="number">0</span>, <span class="string">'b'</span>), (<span class="number">0</span>, <span class="string">'c'</span>), (<span class="number">1</span>, <span class="string">'c'</span>), (<span class="number">1</span>, <span class="string">'b'</span>), (<span class="number">2</span>, <span class="string">'b'</span>)];
itertools::assert_equal(data.into_iter().dedup_by_with_count(|x, y| x.<span class="number">1 </span>== y.<span class="number">1</span>),
<span class="macro">vec!</span>[(<span class="number">2</span>, (<span class="number">0</span>, <span class="string">'a'</span>)), (<span class="number">1</span>, (<span class="number">0</span>, <span class="string">'b'</span>)), (<span class="number">2</span>, (<span class="number">0</span>, <span class="string">'c'</span>)), (<span class="number">2</span>, (<span class="number">1</span>, <span class="string">'b'</span>))]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.duplicates" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1389-1395">source</a><h4 class="code-header">fn <a href="#method.duplicates" class="fn">duplicates</a>(self) -&gt; <a class="type" href="structs/type.Duplicates.html" title="type itertools::structs::Duplicates">Duplicates</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that produces elements that appear more than once during the
iteration. Duplicates are detected using hash and equality.</p>
<p>The iterator is stable, returning the duplicate items in the order in which they occur in
the adapted iterator. Each duplicate item is returned exactly once. If an item appears more
than twice, the second item is the item retained and the rest are discarded.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">40</span>, <span class="number">10</span>, <span class="number">50</span>];
itertools::assert_equal(data.into_iter().duplicates(),
<span class="macro">vec!</span>[<span class="number">20</span>, <span class="number">10</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.duplicates_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1415-1422">source</a><h4 class="code-header">fn <a href="#method.duplicates_by" class="fn">duplicates_by</a>&lt;V, F&gt;(self, f: F) -&gt; <a class="type" href="structs/type.DuplicatesBy.html" title="type itertools::structs::DuplicatesBy">DuplicatesBy</a>&lt;Self, V, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
V: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; V,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that produces elements that appear more than once during the
iteration. Duplicates are detected using hash and equality.</p>
<p>Duplicates are detected by comparing the key they map to with the keying function <code>f</code> by
hash and equality. The keys are stored in a hash map in the iterator.</p>
<p>The iterator is stable, returning the duplicate items in the order in which they occur in
the adapted iterator. Each duplicate item is returned exactly once. If an item appears more
than twice, the second item is the item retained and the rest are discarded.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="string">"a"</span>, <span class="string">"bb"</span>, <span class="string">"aa"</span>, <span class="string">"c"</span>, <span class="string">"ccc"</span>];
itertools::assert_equal(data.into_iter().duplicates_by(|s| s.len()),
<span class="macro">vec!</span>[<span class="string">"aa"</span>, <span class="string">"c"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unique" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1443-1449">source</a><h4 class="code-header">fn <a href="#method.unique" class="fn">unique</a>(self) -&gt; <a class="struct" href="structs/struct.Unique.html" title="struct itertools::structs::Unique">Unique</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Unique&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that filters out elements that have
already been produced once during the iteration. Duplicates
are detected using hash and equality.</p>
<p>Clones of visited elements are stored in a hash set in the
iterator.</p>
<p>The iterator is stable, returning the non-duplicate items in the order
in which they occur in the adapted iterator. In a set of duplicate
items, the first item encountered is the item retained.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">40</span>, <span class="number">10</span>, <span class="number">50</span>];
itertools::assert_equal(data.into_iter().unique(),
<span class="macro">vec!</span>[<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">40</span>, <span class="number">50</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unique_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1470-1477">source</a><h4 class="code-header">fn <a href="#method.unique_by" class="fn">unique_by</a>&lt;V, F&gt;(self, f: F) -&gt; <a class="struct" href="structs/struct.UniqueBy.html" title="struct itertools::structs::UniqueBy">UniqueBy</a>&lt;Self, V, F&gt; <a href="#" class="tooltip" data-notable-ty="UniqueBy&lt;Self, V, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
V: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; V,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that filters out elements that have
already been produced once during the iteration.</p>
<p>Duplicates are detected by comparing the key they map to
with the keying function <code>f</code> by hash and equality.
The keys are stored in a hash set in the iterator.</p>
<p>The iterator is stable, returning the non-duplicate items in the order
in which they occur in the adapted iterator. In a set of duplicate
items, the first item encountered is the item retained.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="string">"a"</span>, <span class="string">"bb"</span>, <span class="string">"aa"</span>, <span class="string">"c"</span>, <span class="string">"ccc"</span>];
itertools::assert_equal(data.into_iter().unique_by(|s| s.len()),
<span class="macro">vec!</span>[<span class="string">"a"</span>, <span class="string">"bb"</span>, <span class="string">"ccc"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.peeking_take_while" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1491-1497">source</a><h4 class="code-header">fn <a href="#method.peeking_take_while" class="fn">peeking_take_while</a>&lt;F&gt;(&amp;mut self, accept: F) -&gt; <a class="struct" href="structs/struct.PeekingTakeWhile.html" title="struct itertools::structs::PeekingTakeWhile">PeekingTakeWhile</a>&lt;'_, Self, F&gt; <a href="#" class="tooltip" data-notable-ty="PeekingTakeWhile&lt;&#39;_, Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.PeekingNext.html" title="trait itertools::PeekingNext">PeekingNext</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that borrows from this iterator and
takes items while the closure <code>accept</code> returns <code>true</code>.</p>
<p>This adaptor can only be used on iterators that implement <code>PeekingNext</code>
like <code>.peekable()</code>, <code>put_back</code> and a few other collection iterators.</p>
<p>The last and rejected element (first <code>false</code>) is still available when
<code>peeking_take_while</code> is done.</p>
<p>See also <a href="trait.Itertools.html#method.take_while_ref" title="method itertools::Itertools::take_while_ref"><code>.take_while_ref()</code></a>
which is a similar adaptor.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.take_while_ref" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1517-1523">source</a><h4 class="code-header">fn <a href="#method.take_while_ref" class="fn">take_while_ref</a>&lt;F&gt;(&amp;mut self, accept: F) -&gt; <a class="struct" href="structs/struct.TakeWhileRef.html" title="struct itertools::structs::TakeWhileRef">TakeWhileRef</a>&lt;'_, Self, F&gt; <a href="#" class="tooltip" data-notable-ty="TakeWhileRef&lt;&#39;_, Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that borrows from a <code>Clone</code>-able iterator
to only pick off elements while the predicate <code>accept</code> returns <code>true</code>.</p>
<p>It uses the <code>Clone</code> trait to restore the original iterator so that the
last and rejected element (first <code>false</code>) is still available when
<code>take_while_ref</code> is done.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>hexadecimals = <span class="string">"0123456789abcdef"</span>.chars();
<span class="kw">let </span>decimals = hexadecimals.take_while_ref(|c| c.is_numeric())
.collect::&lt;String&gt;();
<span class="macro">assert_eq!</span>(decimals, <span class="string">"0123456789"</span>);
<span class="macro">assert_eq!</span>(hexadecimals.next(), <span class="prelude-val">Some</span>(<span class="string">'a'</span>));
</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.take_while_inclusive" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1585-1591">source</a><h4 class="code-header">fn <a href="#method.take_while_inclusive" class="fn">take_while_inclusive</a>&lt;F&gt;(self, accept: F) -&gt; <a class="struct" href="structs/struct.TakeWhileInclusive.html" title="struct itertools::structs::TakeWhileInclusive">TakeWhileInclusive</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="TakeWhileInclusive&lt;Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator adaptor that consumes elements while the given
predicate is <code>true</code>, <em>including</em> the element for which the predicate
first returned <code>false</code>.</p>
<p>The <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.take_while" title="method core::iter::traits::iterator::Iterator::take_while"><code>.take_while()</code></a> adaptor is useful
when you want items satisfying a predicate, but to know when to stop
taking elements, we have to consume that first element that doesnt
satisfy the predicate. This adaptor includes that element where
<a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.take_while" title="method core::iter::traits::iterator::Iterator::take_while"><code>.take_while()</code></a> would drop it.</p>
<p>The <a href="trait.Itertools.html#method.take_while_ref" title="method itertools::Itertools::take_while_ref"><code>.take_while_ref()</code></a> adaptor
serves a similar purpose, but this adaptor doesnt require <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone"><code>Clone</code></a>ing
the underlying elements.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>items = <span class="macro">vec!</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="kw">let </span>filtered: Vec&lt;<span class="kw">_</span>&gt; = items
.into_iter()
.take_while_inclusive(|<span class="kw-2">&amp;</span>n| n % <span class="number">3 </span>!= <span class="number">0</span>)
.collect();
<span class="macro">assert_eq!</span>(filtered, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>items = <span class="macro">vec!</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="kw">let </span>take_while_inclusive_result: Vec&lt;<span class="kw">_</span>&gt; = items
.iter()
.copied()
.take_while_inclusive(|<span class="kw-2">&amp;</span>n| n % <span class="number">3 </span>!= <span class="number">0</span>)
.collect();
<span class="kw">let </span>take_while_result: Vec&lt;<span class="kw">_</span>&gt; = items
.into_iter()
.take_while(|<span class="kw-2">&amp;</span>n| n % <span class="number">3 </span>!= <span class="number">0</span>)
.collect();
<span class="macro">assert_eq!</span>(take_while_inclusive_result, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);
<span class="macro">assert_eq!</span>(take_while_result, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>]);
<span class="comment">// both iterators have the same items remaining at this point---the 3
// is lost from the `take_while` vec</span></code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[derive(Debug, PartialEq)]
</span><span class="kw">struct </span>NoCloneImpl(i32);
<span class="kw">let </span>non_clonable_items: Vec&lt;<span class="kw">_</span>&gt; = <span class="macro">vec!</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>]
.into_iter()
.map(NoCloneImpl)
.collect();
<span class="kw">let </span>filtered: Vec&lt;<span class="kw">_</span>&gt; = non_clonable_items
.into_iter()
.take_while_inclusive(|n| n.<span class="number">0 </span>% <span class="number">3 </span>!= <span class="number">0</span>)
.collect();
<span class="kw">let </span>expected: Vec&lt;<span class="kw">_</span>&gt; = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>].into_iter().map(NoCloneImpl).collect();
<span class="macro">assert_eq!</span>(filtered, expected);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.while_some" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1607-1612">source</a><h4 class="code-header">fn <a href="#method.while_some" class="fn">while_some</a>&lt;A&gt;(self) -&gt; <a class="struct" href="structs/struct.WhileSome.html" title="struct itertools::structs::WhileSome">WhileSome</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="WhileSome&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;A&gt;&gt;,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that filters <code>Option&lt;A&gt;</code> iterator elements
and produces <code>A</code>. Stops on the first <code>None</code> encountered.</p>
<p>Iterator element type is <code>A</code>, the unwrapped element.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// List all hexadecimal digits
</span>itertools::assert_equal(
(<span class="number">0</span>..).map(|i| std::char::from_digit(i, <span class="number">16</span>)).while_some(),
<span class="string">"0123456789abcdef"</span>.chars());
</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tuple_combinations" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1652-1659">source</a><h4 class="code-header">fn <a href="#method.tuple_combinations" class="fn">tuple_combinations</a>&lt;T&gt;(self) -&gt; <a class="struct" href="structs/struct.TupleCombinations.html" title="struct itertools::structs::TupleCombinations">TupleCombinations</a>&lt;Self, T&gt; <a href="#" class="tooltip" data-notable-ty="TupleCombinations&lt;Self, T&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
T: HasCombination&lt;Self&gt;,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that iterates over the combinations of the
elements from an iterator.</p>
<p>Iterator element can be any homogeneous tuple of type <code>Self::Item</code> with
size up to 12.</p>
<h5 id="guarantees"><a class="doc-anchor" href="#guarantees">§</a>Guarantees</h5>
<p>If the adapted iterator is deterministic,
this iterator adapter yields items in a reliable order.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>v = Vec::new();
<span class="kw">for </span>(a, b) <span class="kw">in </span>(<span class="number">1</span>..<span class="number">5</span>).tuple_combinations() {
v.push((a, b));
}
<span class="macro">assert_eq!</span>(v, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">1</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">4</span>), (<span class="number">2</span>, <span class="number">3</span>), (<span class="number">2</span>, <span class="number">4</span>), (<span class="number">3</span>, <span class="number">4</span>)]);
<span class="kw">let </span><span class="kw-2">mut </span>it = (<span class="number">1</span>..<span class="number">5</span>).tuple_combinations();
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">3</span>, <span class="number">4</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)), it.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());
<span class="comment">// this requires a type hint
</span><span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">5</span>).tuple_combinations::&lt;(<span class="kw">_</span>, <span class="kw">_</span>, <span class="kw">_</span>)&gt;();
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>), (<span class="number">1</span>, <span class="number">3</span>, <span class="number">4</span>), (<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)]);
<span class="comment">// you can also specify the complete type
</span><span class="kw">use </span>itertools::TupleCombinations;
<span class="kw">use </span>std::ops::Range;
<span class="kw">let </span>it: TupleCombinations&lt;Range&lt;u32&gt;, (u32, u32, u32)&gt; = (<span class="number">1</span>..<span class="number">5</span>).tuple_combinations();
itertools::assert_equal(it, <span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>), (<span class="number">1</span>, <span class="number">3</span>, <span class="number">4</span>), (<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.combinations" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1696-1702">source</a><h4 class="code-header">fn <a href="#method.combinations" class="fn">combinations</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="structs/struct.Combinations.html" title="struct itertools::structs::Combinations">Combinations</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Combinations&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that iterates over the <code>k</code>-length combinations of
the elements from an iterator.</p>
<p>Iterator element type is <code>Vec&lt;Self::Item&gt;</code>. The iterator produces a new <code>Vec</code> per iteration,
and clones the iterator elements.</p>
<h5 id="guarantees-1"><a class="doc-anchor" href="#guarantees-1">§</a>Guarantees</h5>
<p>If the adapted iterator is deterministic,
this iterator adapter yields items in a reliable order.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">5</span>).combinations(<span class="number">3</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">4</span>],
<span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>],
]);</code></pre></div>
<p>Note: Combinations does not take into account the equality of the iterated values.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>].into_iter().combinations(<span class="number">2</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>], <span class="comment">// Note: these are the same
</span><span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>], <span class="comment">// Note: these are the same
</span><span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">2</span>],
]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.combinations_with_replacement" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1724-1730">source</a><h4 class="code-header">fn <a href="#method.combinations_with_replacement" class="fn">combinations_with_replacement</a>(
self,
k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>,
) -&gt; <a class="struct" href="structs/struct.CombinationsWithReplacement.html" title="struct itertools::structs::CombinationsWithReplacement">CombinationsWithReplacement</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="CombinationsWithReplacement&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator that iterates over the <code>k</code>-length combinations of
the elements from an iterator, with replacement.</p>
<p>Iterator element type is <code>Vec&lt;Self::Item&gt;</code>. The iterator produces a new <code>Vec</code> per iteration,
and clones the iterator elements.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">1</span>..<span class="number">4</span>).combinations_with_replacement(<span class="number">2</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">1</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>],
<span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">2</span>],
<span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">3</span>],
<span class="macro">vec!</span>[<span class="number">3</span>, <span class="number">3</span>],
]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.permutations" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1773-1779">source</a><h4 class="code-header">fn <a href="#method.permutations" class="fn">permutations</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="structs/struct.Permutations.html" title="struct itertools::structs::Permutations">Permutations</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Permutations&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that iterates over all k-permutations of the
elements from an iterator.</p>
<p>Iterator element type is <code>Vec&lt;Self::Item&gt;</code> with length <code>k</code>. The iterator
produces a new <code>Vec</code> per iteration, and clones the iterator elements.</p>
<p>If <code>k</code> is greater than the length of the input iterator, the resultant
iterator adaptor will be empty.</p>
<p>If you are looking for permutations with replacements,
use <code>repeat_n(iter, k).multi_cartesian_product()</code> instead.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>perms = (<span class="number">5</span>..<span class="number">8</span>).permutations(<span class="number">2</span>);
itertools::assert_equal(perms, <span class="macro">vec!</span>[
<span class="macro">vec!</span>[<span class="number">5</span>, <span class="number">6</span>],
<span class="macro">vec!</span>[<span class="number">5</span>, <span class="number">7</span>],
<span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">5</span>],
<span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">7</span>],
<span class="macro">vec!</span>[<span class="number">7</span>, <span class="number">5</span>],
<span class="macro">vec!</span>[<span class="number">7</span>, <span class="number">6</span>],
]);</code></pre></div>
<p>Note: Permutations does not take into account the equality of the iterated values.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">2</span>].into_iter().permutations(<span class="number">2</span>);
itertools::assert_equal(it, <span class="macro">vec!</span>[
<span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">2</span>], <span class="comment">// Note: these are the same
</span><span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">2</span>], <span class="comment">// Note: these are the same
</span>]);</code></pre></div>
<p>Note: The source iterator is collected lazily, and will not be
re-iterated if the permutations adaptor is completed and re-iterated.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.powerset" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1810-1816">source</a><h4 class="code-header">fn <a href="#method.powerset" class="fn">powerset</a>(self) -&gt; <a class="struct" href="structs/struct.Powerset.html" title="struct itertools::structs::Powerset">Powerset</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="Powerset&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator that iterates through the powerset of the elements from an
iterator.</p>
<p>Iterator element type is <code>Vec&lt;Self::Item&gt;</code>. The iterator produces a new <code>Vec</code>
per iteration, and clones the iterator elements.</p>
<p>The powerset of a set contains all subsets including the empty set and the full
input set. A powerset has length <em>2^n</em> where <em>n</em> is the length of the input
set.</p>
<p>Each <code>Vec</code> produced by this iterator represents a subset of the elements
produced by the source iterator.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>sets = (<span class="number">1</span>..<span class="number">4</span>).powerset().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;();
itertools::assert_equal(sets, <span class="macro">vec!</span>[
<span class="macro">vec!</span>[],
<span class="macro">vec!</span>[<span class="number">1</span>],
<span class="macro">vec!</span>[<span class="number">2</span>],
<span class="macro">vec!</span>[<span class="number">3</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>],
<span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">3</span>],
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>],
]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pad_using" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1835-1841">source</a><h4 class="code-header">fn <a href="#method.pad_using" class="fn">pad_using</a>&lt;F&gt;(self, min: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="struct" href="structs/struct.PadUsing.html" title="struct itertools::structs::PadUsing">PadUsing</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="PadUsing&lt;Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that pads the sequence to a minimum length of
<code>min</code> by filling missing elements using a closure <code>f</code>.</p>
<p>Iterator element type is <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">5</span>).pad_using(<span class="number">10</span>, |i| <span class="number">2</span><span class="kw-2">*</span>i);
itertools::assert_equal(it, <span class="macro">vec!</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">10</span>, <span class="number">12</span>, <span class="number">14</span>, <span class="number">16</span>, <span class="number">18</span>]);
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">10</span>).pad_using(<span class="number">5</span>, |i| <span class="number">2</span><span class="kw-2">*</span>i);
itertools::assert_equal(it, <span class="macro">vec!</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="number">7</span>, <span class="number">8</span>, <span class="number">9</span>]);
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">5</span>).pad_using(<span class="number">10</span>, |i| <span class="number">2</span><span class="kw-2">*</span>i).rev();
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="number">18</span>, <span class="number">16</span>, <span class="number">14</span>, <span class="number">12</span>, <span class="number">10</span>, <span class="number">4</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">0</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_position" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1862-1867">source</a><h4 class="code-header">fn <a href="#method.with_position" class="fn">with_position</a>(self) -&gt; <a class="struct" href="structs/struct.WithPosition.html" title="struct itertools::structs::WithPosition">WithPosition</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="WithPosition&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that combines each element with a <code>Position</code> to
ease special-case handling of the first or last elements.</p>
<p>Iterator element type is
<a href="enum.Position.html" title="enum itertools::Position"><code>(Position, Self::Item)</code></a></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::{Itertools, Position};
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">4</span>).with_position();
itertools::assert_equal(it,
<span class="macro">vec!</span>[(Position::First, <span class="number">0</span>),
(Position::Middle, <span class="number">1</span>),
(Position::Middle, <span class="number">2</span>),
(Position::Last, <span class="number">3</span>)]);
<span class="kw">let </span>it = (<span class="number">0</span>..<span class="number">1</span>).with_position();
itertools::assert_equal(it, <span class="macro">vec!</span>[(Position::Only, <span class="number">0</span>)]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.positions" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1882-1888">source</a><h4 class="code-header">fn <a href="#method.positions" class="fn">positions</a>&lt;P&gt;(self, predicate: P) -&gt; <a class="struct" href="structs/struct.Positions.html" title="struct itertools::structs::Positions">Positions</a>&lt;Self, P&gt; <a href="#" class="tooltip" data-notable-ty="Positions&lt;Self, P&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that yields the indices of all elements
satisfying a predicate, counted from the start of the iterator.</p>
<p>Equivalent to <code>iter.enumerate().filter(|(_, v)| predicate(*v)).map(|(i, _)| i)</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">9</span>];
itertools::assert_equal(data.iter().positions(|v| v % <span class="number">2 </span>== <span class="number">0</span>), <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">4</span>, <span class="number">5</span>]);
itertools::assert_equal(data.iter().positions(|v| v % <span class="number">2 </span>== <span class="number">1</span>).rev(), <span class="macro">vec!</span>[<span class="number">7</span>, <span class="number">6</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">0</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.update" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1900-1906">source</a><h4 class="code-header">fn <a href="#method.update" class="fn">update</a>&lt;F&gt;(self, updater: F) -&gt; <a class="struct" href="structs/struct.Update.html" title="struct itertools::structs::Update">Update</a>&lt;Self, F&gt; <a href="#" class="tooltip" data-notable-ty="Update&lt;Self, F&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;mut Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>),</div></h4></section></summary><div class="docblock"><p>Return an iterator adaptor that applies a mutating function
to each element before yielding it.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>input = <span class="macro">vec!</span>[<span class="macro">vec!</span>[<span class="number">1</span>], <span class="macro">vec!</span>[<span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]];
<span class="kw">let </span>it = input.into_iter().update(|<span class="kw-2">mut </span>v| v.push(<span class="number">0</span>));
itertools::assert_equal(it, <span class="macro">vec!</span>[<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">0</span>], <span class="macro">vec!</span>[<span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">0</span>]]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_tuple" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1922-1928">source</a><h4 class="code-header">fn <a href="#method.next_tuple" class="fn">next_tuple</a>&lt;T&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a>,</div></h4></section></summary><div class="docblock"><p>Advances the iterator and returns the next items grouped in a tuple of
a specific size (up to 12).</p>
<p>If there are enough elements to be grouped in a tuple, then the tuple is
returned inside <code>Some</code>, otherwise <code>None</code> is returned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>iter = <span class="number">1</span>..<span class="number">5</span>;
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="number">2</span>)), iter.next_tuple());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.collect_tuple" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1948-1960">source</a><h4 class="code-header">fn <a href="#method.collect_tuple" class="fn">collect_tuple</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T::Item&gt;,
T: <a class="trait" href="traits/trait.HomogeneousTuple.html" title="trait itertools::traits::HomogeneousTuple">HomogeneousTuple</a>,</div></h4></section></summary><div class="docblock"><p>Collects all items from the iterator into a tuple of a specific size
(up to 12).</p>
<p>If the number of elements inside the iterator is <strong>exactly</strong> equal to
the tuple size, then the tuple is returned inside <code>Some</code>, otherwise
<code>None</code> is returned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>iter = <span class="number">1</span>..<span class="number">3</span>;
<span class="kw">if let </span><span class="prelude-val">Some</span>((x, y)) = iter.collect_tuple() {
<span class="macro">assert_eq!</span>((x, y), (<span class="number">1</span>, <span class="number">2</span>))
} <span class="kw">else </span>{
<span class="macro">panic!</span>(<span class="string">"Expected two elements"</span>)
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_position" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1972-1977">source</a><h4 class="code-header">fn <a href="#method.find_position" class="fn">find_position</a>&lt;P&gt;(&amp;mut self, pred: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)&gt;<div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Find the position and value of the first element satisfying a predicate.</p>
<p>The iterator is not advanced past the first element found.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>text = <span class="string">"Hα"</span>;
<span class="macro">assert_eq!</span>(text.chars().find_position(|ch| ch.is_lowercase()), <span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="string">'α'</span>)));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_or_last" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#1990-2005">source</a><h4 class="code-header">fn <a href="#method.find_or_last" class="fn">find_or_last</a>&lt;P&gt;(self, predicate: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Find the value of the first element satisfying a predicate or return the last element, if any.</p>
<p>The iterator is not advanced past the first element found.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>numbers = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
<span class="macro">assert_eq!</span>(numbers.iter().find_or_last(|&amp;&amp;x| x &gt; <span class="number">5</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">4</span>));
<span class="macro">assert_eq!</span>(numbers.iter().find_or_last(|&amp;&amp;x| x &gt; <span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">3</span>));
<span class="macro">assert_eq!</span>(std::iter::empty::&lt;i32&gt;().find_or_last(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">5</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_or_first" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2018-2029">source</a><h4 class="code-header">fn <a href="#method.find_or_first" class="fn">find_or_first</a>&lt;P&gt;(self, predicate: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Find the value of the first element satisfying a predicate or return the first element, if any.</p>
<p>The iterator is not advanced past the first element found.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>numbers = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
<span class="macro">assert_eq!</span>(numbers.iter().find_or_first(|&amp;&amp;x| x &gt; <span class="number">5</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(numbers.iter().find_or_first(|&amp;&amp;x| x &gt; <span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">3</span>));
<span class="macro">assert_eq!</span>(std::iter::empty::&lt;i32&gt;().find_or_first(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">5</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.contains" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2055-2062">source</a><h4 class="code-header">fn <a href="#method.contains" class="fn">contains</a>&lt;Q&gt;(&amp;mut self, query: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Q</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;Q&gt;,
Q: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the given item is present in this iterator.</p>
<p>This method is short-circuiting. If the given item is present in this
iterator, this method will consume the iterator up-to-and-including
the item. If the given item is not present in this iterator, the
iterator will be exhausted.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="attr">#[derive(PartialEq, Debug)]
</span><span class="kw">enum </span>Enum { A, B, C, D, E, }
<span class="kw">let </span><span class="kw-2">mut </span>iter = <span class="macro">vec!</span>[Enum::A, Enum::B, Enum::C, Enum::D].into_iter();
<span class="comment">// search `iter` for `B`
</span><span class="macro">assert_eq!</span>(iter.contains(<span class="kw-2">&amp;</span>Enum::B), <span class="bool-val">true</span>);
<span class="comment">// `B` was found, so the iterator now rests at the item after `B` (i.e, `C`).
</span><span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(Enum::C));
<span class="comment">// search `iter` for `E`
</span><span class="macro">assert_eq!</span>(iter.contains(<span class="kw-2">&amp;</span>Enum::E), <span class="bool-val">false</span>);
<span class="comment">// `E` wasn't found, so `iter` is now exhausted
</span><span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.all_equal" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2080-2089">source</a><h4 class="code-header">fn <a href="#method.all_equal" class="fn">all_equal</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Check whether all elements compare equal.</p>
<p>Empty iterators are considered to have equal elements:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">5</span>];
<span class="macro">assert!</span>(!data.iter().all_equal());
<span class="macro">assert!</span>(data[<span class="number">0</span>..<span class="number">3</span>].iter().all_equal());
<span class="macro">assert!</span>(data[<span class="number">3</span>..<span class="number">5</span>].iter().all_equal());
<span class="macro">assert!</span>(data[<span class="number">5</span>..<span class="number">8</span>].iter().all_equal());
<span class="kw">let </span>data : <span class="prelude-ty">Option</span>&lt;usize&gt; = <span class="prelude-val">None</span>;
<span class="macro">assert!</span>(data.into_iter().all_equal());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.all_equal_value" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2109-2121">source</a><h4 class="code-header">fn <a href="#method.all_equal_value" class="fn">all_equal_value</a>(
&amp;mut self,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>)&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>If there are elements and they are all equal, return a single copy of that element.
If there are no elements, return an Error containing None.
If there are elements and they are not all equal, return a tuple containing the first
two non-equal elements found.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">5</span>];
<span class="macro">assert_eq!</span>(data.iter().all_equal_value(), <span class="prelude-val">Err</span>(<span class="prelude-val">Some</span>((<span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">2</span>))));
<span class="macro">assert_eq!</span>(data[<span class="number">0</span>..<span class="number">3</span>].iter().all_equal_value(), <span class="prelude-val">Ok</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(data[<span class="number">3</span>..<span class="number">5</span>].iter().all_equal_value(), <span class="prelude-val">Ok</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(data[<span class="number">5</span>..<span class="number">8</span>].iter().all_equal_value(), <span class="prelude-val">Ok</span>(<span class="kw-2">&amp;</span><span class="number">3</span>));
<span class="kw">let </span>data : <span class="prelude-ty">Option</span>&lt;usize&gt; = <span class="prelude-val">None</span>;
<span class="macro">assert_eq!</span>(data.into_iter().all_equal_value(), <span class="prelude-val">Err</span>(<span class="prelude-val">None</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.all_unique" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2139-2146">source</a><h4 class="code-header">fn <a href="#method.all_unique" class="fn">all_unique</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,</div></h4></section></summary><div class="docblock"><p>Check whether all elements are unique (non equal).</p>
<p>Empty iterators are considered to have unique elements:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="number">5</span>];
<span class="macro">assert!</span>(!data.iter().all_unique());
<span class="macro">assert!</span>(data[<span class="number">0</span>..<span class="number">4</span>].iter().all_unique());
<span class="macro">assert!</span>(data[<span class="number">1</span>..<span class="number">6</span>].iter().all_unique());
<span class="kw">let </span>data : <span class="prelude-ty">Option</span>&lt;usize&gt; = <span class="prelude-val">None</span>;
<span class="macro">assert!</span>(data.into_iter().all_unique());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dropping" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2163-2171">source</a><h4 class="code-header">fn <a href="#method.dropping" class="fn">dropping</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Consume the first <code>n</code> elements from the iterator eagerly,
and return the same iterator again.</p>
<p>It works similarly to <code>.skip(n)</code> except it is eager and
preserves the iterator type.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>iter = <span class="string">"αβγ"</span>.chars().dropping(<span class="number">2</span>);
itertools::assert_equal(iter, <span class="string">"γ"</span>.chars());</code></pre></div>
<p><em>Fusing notes: if the iterator is exhausted by dropping,
the result of calling <code>.next()</code> again depends on the iterator implementation.</em></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dropping_back" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2188-2196">source</a><h4 class="code-header">fn <a href="#method.dropping_back" class="fn">dropping_back</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator">DoubleEndedIterator</a>,</div></h4></section></summary><div class="docblock"><p>Consume the last <code>n</code> elements from the iterator eagerly,
and return the same iterator again.</p>
<p>This is only possible on double ended iterators. <code>n</code> may be
larger than the number of elements.</p>
<p>Note: This method is eager, dropping the back elements immediately and
preserves the iterator type.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>init = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">3</span>, <span class="number">6</span>, <span class="number">9</span>].into_iter().dropping_back(<span class="number">1</span>);
itertools::assert_equal(init, <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">3</span>, <span class="number">6</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.concat" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2211-2218">source</a><h4 class="code-header">fn <a href="#method.concat" class="fn">concat</a>(self) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;&lt;Self as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</div></h4></section></summary><div class="docblock"><p>Combine all an iterators elements into one element by using <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend"><code>Extend</code></a>.</p>
<p>This combinator will extend the first item with each of the rest of the
items of the iterator. If the iterator is empty, the default value of
<code>I::Item</code> is returned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>input = <span class="macro">vec!</span>[<span class="macro">vec!</span>[<span class="number">1</span>], <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">3</span>], <span class="macro">vec!</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]];
<span class="macro">assert_eq!</span>(input.into_iter().concat(),
<span class="macro">vec!</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>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.collect_vec" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2223-2228">source</a><h4 class="code-header">fn <a href="#method.collect_vec" class="fn">collect_vec</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p><code>.collect_vec()</code> is simply a type specialization of <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.collect" title="method core::iter::traits::iterator::Iterator::collect"><code>Iterator::collect</code></a>,
for convenience.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_collect" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2250-2256">source</a><h4 class="code-header">fn <a href="#method.try_collect" class="fn">try_collect</a>&lt;T, U, E&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, E&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt;,
<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, E&gt;: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt;,</div></h4></section></summary><div class="docblock"><p><code>.try_collect()</code> is more convenient way of writing
<code>.collect::&lt;Result&lt;_, _&gt;&gt;()</code></p>
<h5 id="example-1"><a class="doc-anchor" href="#example-1">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::{fs, io};
<span class="kw">use </span>itertools::Itertools;
<span class="kw">fn </span>process_dir_entries(entries: <span class="kw-2">&amp;</span>[fs::DirEntry]) {
<span class="comment">// ...
</span>}
<span class="kw">fn </span>do_stuff() -&gt; std::io::Result&lt;()&gt; {
<span class="kw">let </span>entries: Vec&lt;<span class="kw">_</span>&gt; = fs::read_dir(<span class="string">"."</span>)<span class="question-mark">?</span>.try_collect()<span class="question-mark">?</span>;
process_dir_entries(<span class="kw-2">&amp;</span>entries);
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_from" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2274-2283">source</a><h4 class="code-header">fn <a href="#method.set_from" class="fn">set_from</a>&lt;'a, A: 'a, J&gt;(&amp;mut self, from: J) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;'a mut A</a>&gt;,
J: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = A&gt;,</div></h4></section></summary><div class="docblock"><p>Assign to each reference in <code>self</code> from the <code>from</code> iterator,
stopping at the shortest of the two iterators.</p>
<p>The <code>from</code> iterator is queried for its next element before the <code>self</code>
iterator, and if either is exhausted the method is done.</p>
<p>Return the number of elements written.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>xs = [<span class="number">0</span>; <span class="number">4</span>];
xs.iter_mut().set_from(<span class="number">1</span>..);
<span class="macro">assert_eq!</span>(xs, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.join" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2296-2314">source</a><h4 class="code-header">fn <a href="#method.join" class="fn">join</a>(&amp;mut self, sep: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a><div class="where">where
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h4></section></summary><div class="docblock"><p>Combine all iterator elements into one <code>String</code>, separated by <code>sep</code>.</p>
<p>Use the <code>Display</code> implementation of each element.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="macro">assert_eq!</span>([<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>].iter().join(<span class="string">", "</span>), <span class="string">"a, b, c"</span>);
<span class="macro">assert_eq!</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>].iter().join(<span class="string">", "</span>), <span class="string">"1, 2, 3"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2331-2336">source</a><h4 class="code-header">fn <a href="#method.format" class="fn">format</a>(self, sep: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="structs/struct.Format.html" title="struct itertools::structs::Format">Format</a>&lt;'_, Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Format all iterator elements, separated by <code>sep</code>.</p>
<p>All elements are formatted (any formatting trait)
with <code>sep</code> inserted between each element.</p>
<p><strong>Panics</strong> if the formatter helper is formatted more than once.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = [<span class="number">1.1</span>, <span class="number">2.71828</span>, -<span class="number">3.</span>];
<span class="macro">assert_eq!</span>(
<span class="macro">format!</span>(<span class="string">"{:.2}"</span>, data.iter().format(<span class="string">", "</span>)),
<span class="string">"1.10, 2.72, -3.00"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format_with" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2370-2376">source</a><h4 class="code-header">fn <a href="#method.format_with" class="fn">format_with</a>&lt;F&gt;(self, sep: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>, format: F) -&gt; <a class="struct" href="structs/struct.FormatWith.html" title="struct itertools::structs::FormatWith">FormatWith</a>&lt;'_, Self, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;mut dyn <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;dyn <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.80.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/1.80.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>,</div></h4></section></summary><div class="docblock"><p>Format all iterator elements, separated by <code>sep</code>.</p>
<p>This is a customizable version of <a href="trait.Itertools.html#method.format" title="method itertools::Itertools::format"><code>.format()</code></a>.</p>
<p>The supplied closure <code>format</code> is called once per iterator element,
with two arguments: the element and a callback that takes a
<code>&amp;Display</code> value, i.e. any reference to type that implements <code>Display</code>.</p>
<p>Using <code>&amp;format_args!(...)</code> is the most versatile way to apply custom
element formatting. The callback can be called multiple times if needed.</p>
<p><strong>Panics</strong> if the formatter helper is formatted more than once.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = [<span class="number">1.1</span>, <span class="number">2.71828</span>, -<span class="number">3.</span>];
<span class="kw">let </span>data_formatter = data.iter().format_with(<span class="string">", "</span>, |elt, f| f(<span class="kw-2">&amp;</span><span class="macro">format_args!</span>(<span class="string">"{:.2}"</span>, elt)));
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{}"</span>, data_formatter),
<span class="string">"1.10, 2.72, -3.00"</span>);
<span class="comment">// .format_with() is recursively composable
</span><span class="kw">let </span>matrix = [[<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="kw">let </span>matrix_formatter = matrix.iter().format_with(<span class="string">"\n"</span>, |row, f| {
f(<span class="kw-2">&amp;</span>row.iter().format_with(<span class="string">", "</span>, |elt, g| g(<span class="kw-2">&amp;</span>elt)))
});
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{}"</span>, matrix_formatter),
<span class="string">"1, 2, 3\n4, 5, 6"</span>);
</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fold_ok" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2422-2434">source</a><h4 class="code-header">fn <a href="#method.fold_ok" class="fn">fold_ok</a>&lt;A, E, B, F&gt;(&amp;mut self, start: B, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;B, E&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;A, E&gt;&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, A) -&gt; B,</div></h4></section></summary><div class="docblock"><p>Fold <code>Result</code> values from an iterator.</p>
<p>Only <code>Ok</code> values are folded. If no error is encountered, the folded
value is returned inside <code>Ok</code>. Otherwise, the operation terminates
and returns the first <code>Err</code> value it encounters. No iterator elements are
consumed after the first error.</p>
<p>The first accumulator value is the <code>start</code> parameter.
Each iteration passes the accumulator value and the next value inside <code>Ok</code>
to the fold function <code>f</code> and its return value becomes the new accumulator value.</p>
<p>For example the sequence <em>Ok(1), Ok(2), Ok(3)</em> will result in a
computation like this:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>accum = start;
accum = f(accum, <span class="number">1</span>);
accum = f(accum, <span class="number">2</span>);
accum = f(accum, <span class="number">3</span>);</code></pre></div>
<p>With a <code>start</code> value of 0 and an addition as folding function,
this effectively results in <em>((0 + 1) + 2) + 3</em></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::ops::Add;
<span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>values = [<span class="number">1</span>, <span class="number">2</span>, -<span class="number">2</span>, -<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>];
<span class="macro">assert_eq!</span>(
values.iter()
.map(<span class="prelude-val">Ok</span>::&lt;<span class="kw">_</span>, ()&gt;)
.fold_ok(<span class="number">0</span>, Add::add),
<span class="prelude-val">Ok</span>(<span class="number">3</span>)
);
<span class="macro">assert!</span>(
values.iter()
.map(|<span class="kw-2">&amp;</span>x| <span class="kw">if </span>x &gt;= <span class="number">0 </span>{ <span class="prelude-val">Ok</span>(x) } <span class="kw">else </span>{ <span class="prelude-val">Err</span>(<span class="string">"Negative number"</span>) })
.fold_ok(<span class="number">0</span>, Add::add)
.is_err()
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fold_options" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2455-2467">source</a><h4 class="code-header">fn <a href="#method.fold_options" class="fn">fold_options</a>&lt;A, B, F&gt;(&amp;mut self, start: B, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;A&gt;&gt;,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, A) -&gt; B,</div></h4></section></summary><div class="docblock"><p>Fold <code>Option</code> values from an iterator.</p>
<p>Only <code>Some</code> values are folded. If no <code>None</code> is encountered, the folded
value is returned inside <code>Some</code>. Otherwise, the operation terminates
and returns <code>None</code>. No iterator elements are consumed after the <code>None</code>.</p>
<p>This is the <code>Option</code> equivalent to <a href="trait.Itertools.html#method.fold_ok" title="method itertools::Itertools::fold_ok"><code>fold_ok</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::ops::Add;
<span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>values = <span class="macro">vec!</span>[<span class="prelude-val">Some</span>(<span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="number">2</span>), <span class="prelude-val">Some</span>(-<span class="number">2</span>)].into_iter();
<span class="macro">assert_eq!</span>(values.fold_options(<span class="number">5</span>, Add::add), <span class="prelude-val">Some</span>(<span class="number">5 </span>+ <span class="number">1 </span>+ <span class="number">2 </span>- <span class="number">2</span>));
<span class="kw">let </span><span class="kw-2">mut </span>more_values = <span class="macro">vec!</span>[<span class="prelude-val">Some</span>(<span class="number">2</span>), <span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(<span class="number">0</span>)].into_iter();
<span class="macro">assert!</span>(more_values.fold_options(<span class="number">0</span>, Add::add).is_none());
<span class="macro">assert_eq!</span>(more_values.next().unwrap(), <span class="prelude-val">Some</span>(<span class="number">0</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fold1" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2485-2491">source</a><h4 class="code-header">fn <a href="#method.fold1" class="fn">fold1</a>&lt;F&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.10.2: Use <a href="https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.reduce"><code>Iterator::reduce</code></a> instead</span></div></span></summary><div class="docblock"><p>Accumulator of the elements in the iterator.</p>
<p>Like <code>.fold()</code>, without a base case. If the iterator is
empty, return <code>None</code>. With just one element, return it.
Otherwise elements are accumulated in sequence using the closure <code>f</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">10</span>).fold1(|x, y| x + y).unwrap_or(<span class="number">0</span>), <span class="number">45</span>);
<span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">0</span>).fold1(|x, y| x * y), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tree_reduce" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2552-2613">source</a><h4 class="code-header">fn <a href="#method.tree_reduce" class="fn">tree_reduce</a>&lt;F&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Accumulate the elements in the iterator in a tree-like manner.</p>
<p>You can think of it as, while theres more than one item, repeatedly
combining adjacent items. It does so in bottom-up-merge-sort order,
however, so that it needs only logarithmic stack space.</p>
<p>This produces a call tree like the following (where the calls under
an item are done after reading that item):</p>
<div class="example-wrap"><pre class="language-text"><code>1 2 3 4 5 6 7
│ │ │ │ │ │ │
└─f └─f └─f │
│ │ │ │
└───f └─f
│ │
└─────f
</code></pre></div>
<p>Which, for non-associative functions, will typically produce a different
result than the linear call tree used by <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.reduce" title="method core::iter::traits::iterator::Iterator::reduce"><code>Iterator::reduce</code></a>:</p>
<div class="example-wrap"><pre class="language-text"><code>1 2 3 4 5 6 7
│ │ │ │ │ │ │
└─f─f─f─f─f─f
</code></pre></div>
<p>If <code>f</code> is associative you should also decide carefully:</p>
<ul>
<li>if <code>f</code> is a trivial operation like <code>u32::wrapping_add</code>, prefer the normal
<a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.reduce" title="method core::iter::traits::iterator::Iterator::reduce"><code>Iterator::reduce</code></a> instead since it will most likely result in the generation of simpler
code because the compiler is able to optimize it</li>
<li>otherwise if <code>f</code> is non-trivial like <code>format!</code>, you should use <code>tree_reduce</code> since it
reduces the number of operations from <code>O(n)</code> to <code>O(ln(n))</code></li>
</ul>
<p>Here “non-trivial” means:</p>
<ul>
<li>any allocating operation</li>
<li>any function that is a composition of many operations</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// The same tree as above
</span><span class="kw">let </span>num_strings = (<span class="number">1</span>..<span class="number">8</span>).map(|x| x.to_string());
<span class="macro">assert_eq!</span>(num_strings.tree_reduce(|x, y| <span class="macro">format!</span>(<span class="string">"f({}, {})"</span>, x, y)),
<span class="prelude-val">Some</span>(String::from(<span class="string">"f(f(f(1, 2), f(3, 4)), f(f(5, 6), 7))"</span>)));
<span class="comment">// Like fold1, an empty iterator produces None
</span><span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">0</span>).tree_reduce(|x, y| x * y), <span class="prelude-val">None</span>);
<span class="comment">// tree_reduce matches fold1 for associative operations...
</span><span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">10</span>).tree_reduce(|x, y| x + y),
(<span class="number">0</span>..<span class="number">10</span>).fold1(|x, y| x + y));
<span class="comment">// ...but not for non-associative ones
</span><span class="macro">assert_ne!</span>((<span class="number">0</span>..<span class="number">10</span>).tree_reduce(|x, y| x - y),
(<span class="number">0</span>..<span class="number">10</span>).fold1(|x, y| x - y));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tree_fold1" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2617-2623">source</a><h4 class="code-header">fn <a href="#method.tree_fold1" class="fn">tree_fold1</a>&lt;F&gt;(self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.13.0: Use .tree_reduce() instead</span></div></span></summary><div class="docblock"><p>See <a href="trait.Itertools.html#method.tree_reduce" title="method itertools::Itertools::tree_reduce"><code>.tree_reduce()</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fold_while" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2664-2684">source</a><h4 class="code-header">fn <a href="#method.fold_while" class="fn">fold_while</a>&lt;B, F&gt;(&amp;mut self, init: B, f: F) -&gt; <a class="enum" href="enum.FoldWhile.html" title="enum itertools::FoldWhile">FoldWhile</a>&lt;B&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="enum.FoldWhile.html" title="enum itertools::FoldWhile">FoldWhile</a>&lt;B&gt;,</div></h4></section></summary><div class="docblock"><p>An iterator method that applies a function, producing a single, final value.</p>
<p><code>fold_while()</code> is basically equivalent to <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.fold" title="method core::iter::traits::iterator::Iterator::fold"><code>Iterator::fold</code></a> but with additional support for
early exit via short-circuiting.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::FoldWhile::{Continue, Done};
<span class="kw">let </span>numbers = [<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="number">7</span>, <span class="number">8</span>, <span class="number">9</span>, <span class="number">10</span>];
<span class="kw">let </span><span class="kw-2">mut </span>result = <span class="number">0</span>;
<span class="comment">// for loop:
</span><span class="kw">for </span>i <span class="kw">in </span><span class="kw-2">&amp;</span>numbers {
<span class="kw">if </span><span class="kw-2">*</span>i &gt; <span class="number">5 </span>{
<span class="kw">break</span>;
}
result = result + i;
}
<span class="comment">// fold:
</span><span class="kw">let </span>result2 = numbers.iter().fold(<span class="number">0</span>, |acc, x| {
<span class="kw">if </span><span class="kw-2">*</span>x &gt; <span class="number">5 </span>{ acc } <span class="kw">else </span>{ acc + x }
});
<span class="comment">// fold_while:
</span><span class="kw">let </span>result3 = numbers.iter().fold_while(<span class="number">0</span>, |acc, x| {
<span class="kw">if </span><span class="kw-2">*</span>x &gt; <span class="number">5 </span>{ Done(acc) } <span class="kw">else </span>{ Continue(acc + x) }
}).into_inner();
<span class="comment">// they're the same
</span><span class="macro">assert_eq!</span>(result, result2);
<span class="macro">assert_eq!</span>(result2, result3);</code></pre></div>
<p>The big difference between the computations of <code>result2</code> and <code>result3</code> is that while
<code>fold()</code> called the provided closure for every item of the callee iterator,
<code>fold_while()</code> actually stopped iterating as soon as it encountered <code>Fold::Done(_)</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sum1" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2707-2713">source</a><h4 class="code-header">fn <a href="#method.sum1" class="fn">sum1</a>&lt;S&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;S&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
S: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/accum/trait.Sum.html" title="trait core::iter::traits::accum::Sum">Sum</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Iterate over the entire iterator and add all the elements.</p>
<p>An empty iterator returns <code>None</code>, otherwise <code>Some(sum)</code>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>When calling <code>sum1()</code> and a primitive integer type is being returned, this
method will panic if the computation overflows and debug assertions are
enabled.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>empty_sum = (<span class="number">1</span>..<span class="number">1</span>).sum1::&lt;i32&gt;();
<span class="macro">assert_eq!</span>(empty_sum, <span class="prelude-val">None</span>);
<span class="kw">let </span>nonempty_sum = (<span class="number">1</span>..<span class="number">11</span>).sum1::&lt;i32&gt;();
<span class="macro">assert_eq!</span>(nonempty_sum, <span class="prelude-val">Some</span>(<span class="number">55</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.product1" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2735-2741">source</a><h4 class="code-header">fn <a href="#method.product1" class="fn">product1</a>&lt;P&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;P&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
P: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/accum/trait.Product.html" title="trait core::iter::traits::accum::Product">Product</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Iterate over the entire iterator and multiply all the elements.</p>
<p>An empty iterator returns <code>None</code>, otherwise <code>Some(product)</code>.</p>
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
<p>When calling <code>product1()</code> and a primitive integer type is being returned,
method will panic if the computation overflows and debug assertions are
enabled.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>empty_product = (<span class="number">1</span>..<span class="number">1</span>).product1::&lt;i32&gt;();
<span class="macro">assert_eq!</span>(empty_product, <span class="prelude-val">None</span>);
<span class="kw">let </span>nonempty_product = (<span class="number">1</span>..<span class="number">11</span>).product1::&lt;i32&gt;();
<span class="macro">assert_eq!</span>(nonempty_product, <span class="prelude-val">Some</span>(<span class="number">3628800</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_unstable" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2763-2773">source</a><h4 class="code-header">fn <a href="#method.sorted_unstable" class="fn">sorted_unstable</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort_unstable" title="method slice::sort_unstable"><code>slice::sort_unstable</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort the letters of the text in ascending order
</span><span class="kw">let </span>text = <span class="string">"bdacfe"</span>;
itertools::assert_equal(text.chars().sorted_unstable(),
<span class="string">"abcdef"</span>.chars());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_unstable_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2801-2809">source</a><h4 class="code-header">fn <a href="#method.sorted_unstable_by" class="fn">sorted_unstable_by</a>&lt;F&gt;(self, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort_unstable_by" title="method slice::sort_unstable_by"><code>slice::sort_unstable_by</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort people in descending order by age
</span><span class="kw">let </span>people = <span class="macro">vec!</span>[(<span class="string">"Jane"</span>, <span class="number">20</span>), (<span class="string">"John"</span>, <span class="number">18</span>), (<span class="string">"Jill"</span>, <span class="number">30</span>), (<span class="string">"Jack"</span>, <span class="number">27</span>)];
<span class="kw">let </span>oldest_people_first = people
.into_iter()
.sorted_unstable_by(|a, b| Ord::cmp(<span class="kw-2">&amp;</span>b.<span class="number">1</span>, <span class="kw-2">&amp;</span>a.<span class="number">1</span>))
.map(|(person, _age)| person);
itertools::assert_equal(oldest_people_first,
<span class="macro">vec!</span>[<span class="string">"Jill"</span>, <span class="string">"Jack"</span>, <span class="string">"Jane"</span>, <span class="string">"John"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_unstable_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2837-2846">source</a><h4 class="code-header">fn <a href="#method.sorted_unstable_by_key" class="fn">sorted_unstable_by_key</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort_unstable_by_key" title="method slice::sort_unstable_by_key"><code>slice::sort_unstable_by_key</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort people in descending order by age
</span><span class="kw">let </span>people = <span class="macro">vec!</span>[(<span class="string">"Jane"</span>, <span class="number">20</span>), (<span class="string">"John"</span>, <span class="number">18</span>), (<span class="string">"Jill"</span>, <span class="number">30</span>), (<span class="string">"Jack"</span>, <span class="number">27</span>)];
<span class="kw">let </span>oldest_people_first = people
.into_iter()
.sorted_unstable_by_key(|x| -x.<span class="number">1</span>)
.map(|(person, _age)| person);
itertools::assert_equal(oldest_people_first,
<span class="macro">vec!</span>[<span class="string">"Jill"</span>, <span class="string">"Jack"</span>, <span class="string">"Jane"</span>, <span class="string">"John"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2868-2878">source</a><h4 class="code-header">fn <a href="#method.sorted" class="fn">sorted</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort" title="method slice::sort"><code>slice::sort</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort the letters of the text in ascending order
</span><span class="kw">let </span>text = <span class="string">"bdacfe"</span>;
itertools::assert_equal(text.chars().sorted(),
<span class="string">"abcdef"</span>.chars());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2906-2914">source</a><h4 class="code-header">fn <a href="#method.sorted_by" class="fn">sorted_by</a>&lt;F&gt;(self, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort_by" title="method slice::sort_by"><code>slice::sort_by</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort people in descending order by age
</span><span class="kw">let </span>people = <span class="macro">vec!</span>[(<span class="string">"Jane"</span>, <span class="number">20</span>), (<span class="string">"John"</span>, <span class="number">18</span>), (<span class="string">"Jill"</span>, <span class="number">30</span>), (<span class="string">"Jack"</span>, <span class="number">30</span>)];
<span class="kw">let </span>oldest_people_first = people
.into_iter()
.sorted_by(|a, b| Ord::cmp(<span class="kw-2">&amp;</span>b.<span class="number">1</span>, <span class="kw-2">&amp;</span>a.<span class="number">1</span>))
.map(|(person, _age)| person);
itertools::assert_equal(oldest_people_first,
<span class="macro">vec!</span>[<span class="string">"Jill"</span>, <span class="string">"Jack"</span>, <span class="string">"Jane"</span>, <span class="string">"John"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2942-2951">source</a><h4 class="code-header">fn <a href="#method.sorted_by_key" class="fn">sorted_by_key</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort_by_key" title="method slice::sort_by_key"><code>slice::sort_by_key</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort people in descending order by age
</span><span class="kw">let </span>people = <span class="macro">vec!</span>[(<span class="string">"Jane"</span>, <span class="number">20</span>), (<span class="string">"John"</span>, <span class="number">18</span>), (<span class="string">"Jill"</span>, <span class="number">30</span>), (<span class="string">"Jack"</span>, <span class="number">30</span>)];
<span class="kw">let </span>oldest_people_first = people
.into_iter()
.sorted_by_key(|x| -x.<span class="number">1</span>)
.map(|(person, _age)| person);
itertools::assert_equal(oldest_people_first,
<span class="macro">vec!</span>[<span class="string">"Jill"</span>, <span class="string">"Jack"</span>, <span class="string">"Jane"</span>, <span class="string">"John"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.sorted_by_cached_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#2980-2989">source</a><h4 class="code-header">fn <a href="#method.sorted_by_cached_key" class="fn">sorted_by_cached_key</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Sort all iterator elements into a new iterator in ascending order. The key function is
called exactly once per key.</p>
<p><strong>Note:</strong> This consumes the entire iterator, uses the
<a href="https://doc.rust-lang.org/1.80.0/std/primitive.slice.html#method.sort_by_cached_key" title="method slice::sort_by_cached_key"><code>slice::sort_by_cached_key</code></a> method and returns the result as a new
iterator that owns its elements.</p>
<p>This sort is stable (i.e., does not reorder equal elements).</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// sort people in descending order by age
</span><span class="kw">let </span>people = <span class="macro">vec!</span>[(<span class="string">"Jane"</span>, <span class="number">20</span>), (<span class="string">"John"</span>, <span class="number">18</span>), (<span class="string">"Jill"</span>, <span class="number">30</span>), (<span class="string">"Jack"</span>, <span class="number">30</span>)];
<span class="kw">let </span>oldest_people_first = people
.into_iter()
.sorted_by_cached_key(|x| -x.<span class="number">1</span>)
.map(|(person, _age)| person);
itertools::assert_equal(oldest_people_first,
<span class="macro">vec!</span>[<span class="string">"Jill"</span>, <span class="string">"Jack"</span>, <span class="string">"Jane"</span>, <span class="string">"John"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.k_smallest" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3019-3051">source</a><h4 class="code-header">fn <a href="#method.k_smallest" class="fn">k_smallest</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sort the k smallest elements into a new iterator, in ascending order.</p>
<p><strong>Note:</strong> This consumes the entire iterator, and returns the result
as a new iterator that owns its elements. If the input contains
less than k elements, the result is equivalent to <code>self.sorted()</code>.</p>
<p>This is guaranteed to use <code>k * sizeof(Self::Item) + O(1)</code> memory
and <code>O(n log k)</code> time, with <code>n</code> the number of elements in the input.</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<p><strong>Note:</strong> This is functionally-equivalent to <code>self.sorted().take(k)</code>
but much more efficient.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// A random permutation of 0..15
</span><span class="kw">let </span>numbers = <span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">14</span>, <span class="number">0</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">5</span>];
<span class="kw">let </span>five_smallest = numbers
.into_iter()
.k_smallest(<span class="number">5</span>);
itertools::assert_equal(five_smallest, <span class="number">0</span>..<span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.k_smallest_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3077-3083">source</a><h4 class="code-header">fn <a href="#method.k_smallest_by" class="fn">k_smallest_by</a>&lt;F&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort the k smallest elements into a new iterator using the provided comparison.</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<p>This corresponds to <code>self.sorted_by(cmp).take(k)</code> in the same way that
<a href="trait.Itertools.html#method.k_smallest" title="method itertools::Itertools::k_smallest"><code>k_smallest</code></a> corresponds to <code>self.sorted().take(k)</code>,
in both semantics and complexity.</p>
<p>Particularly, a custom heap implementation ensures the comparison is not cloned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// A random permutation of 0..15
</span><span class="kw">let </span>numbers = <span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">14</span>, <span class="number">0</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">5</span>];
<span class="kw">let </span>five_smallest = numbers
.into_iter()
.k_smallest_by(<span class="number">5</span>, |a, b| (a % <span class="number">7</span>).cmp(<span class="kw-2">&amp;</span>(b % <span class="number">7</span>)).then(a.cmp(b)));
itertools::assert_equal(five_smallest, <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">7</span>, <span class="number">14</span>, <span class="number">1</span>, <span class="number">8</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.k_smallest_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3109-3116">source</a><h4 class="code-header">fn <a href="#method.k_smallest_by_key" class="fn">k_smallest_by_key</a>&lt;F, K&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Return the elements producing the k smallest outputs of the provided function.</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<p>This corresponds to <code>self.sorted_by_key(key).take(k)</code> in the same way that
<a href="trait.Itertools.html#method.k_smallest" title="method itertools::Itertools::k_smallest"><code>k_smallest</code></a> corresponds to <code>self.sorted().take(k)</code>,
in both semantics and complexity.</p>
<p>Particularly, a custom heap implementation ensures the comparison is not cloned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// A random permutation of 0..15
</span><span class="kw">let </span>numbers = <span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">14</span>, <span class="number">0</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">5</span>];
<span class="kw">let </span>five_smallest = numbers
.into_iter()
.k_smallest_by_key(<span class="number">5</span>, |n| (n % <span class="number">7</span>, <span class="kw-2">*</span>n));
itertools::assert_equal(five_smallest, <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">7</span>, <span class="number">14</span>, <span class="number">1</span>, <span class="number">8</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.k_largest" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3141-3147">source</a><h4 class="code-header">fn <a href="#method.k_largest" class="fn">k_largest</a>(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Sort the k largest elements into a new iterator, in descending order.</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<p>It is semantically equivalent to <a href="trait.Itertools.html#method.k_smallest" title="method itertools::Itertools::k_smallest"><code>k_smallest</code></a>
with a reversed <code>Ord</code>.
However, this is implemented with a custom binary heap which does not
have the same performance characteristics for very large <code>Self::Item</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// A random permutation of 0..15
</span><span class="kw">let </span>numbers = <span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">14</span>, <span class="number">0</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">5</span>];
<span class="kw">let </span>five_largest = numbers
.into_iter()
.k_largest(<span class="number">5</span>);
itertools::assert_equal(five_largest, <span class="macro">vec!</span>[<span class="number">14</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">11</span>, <span class="number">10</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.k_largest_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3170-3176">source</a><h4 class="code-header">fn <a href="#method.k_largest_by" class="fn">k_largest_by</a>&lt;F&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, cmp: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Sort the k largest elements into a new iterator using the provided comparison.</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<p>Functionally equivalent to <a href="trait.Itertools.html#method.k_smallest_by" title="method itertools::Itertools::k_smallest_by"><code>k_smallest_by</code></a>
with a reversed <code>Ord</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// A random permutation of 0..15
</span><span class="kw">let </span>numbers = <span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">14</span>, <span class="number">0</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">5</span>];
<span class="kw">let </span>five_largest = numbers
.into_iter()
.k_largest_by(<span class="number">5</span>, |a, b| (a % <span class="number">7</span>).cmp(<span class="kw-2">&amp;</span>(b % <span class="number">7</span>)).then(a.cmp(b)));
itertools::assert_equal(five_largest, <span class="macro">vec!</span>[<span class="number">13</span>, <span class="number">6</span>, <span class="number">12</span>, <span class="number">5</span>, <span class="number">11</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.k_largest_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3199-3206">source</a><h4 class="code-header">fn <a href="#method.k_largest_by_key" class="fn">k_largest_by_key</a>&lt;F, K&gt;(self, k: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html" title="struct alloc::vec::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Return the elements producing the k largest outputs of the provided function.</p>
<p>The sorted iterator, if directly collected to a <code>Vec</code>, is converted
without any extra copying or allocation cost.</p>
<p>Functionally equivalent to <a href="trait.Itertools.html#method.k_smallest_by_key" title="method itertools::Itertools::k_smallest_by_key"><code>k_smallest_by_key</code></a>
with a reversed <code>Ord</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="comment">// A random permutation of 0..15
</span><span class="kw">let </span>numbers = <span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">14</span>, <span class="number">0</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">13</span>, <span class="number">12</span>, <span class="number">5</span>];
<span class="kw">let </span>five_largest = numbers
.into_iter()
.k_largest_by_key(<span class="number">5</span>, |n| (n % <span class="number">7</span>, <span class="kw-2">*</span>n));
itertools::assert_equal(five_largest, <span class="macro">vec!</span>[<span class="number">13</span>, <span class="number">6</span>, <span class="number">12</span>, <span class="number">5</span>, <span class="number">11</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tail" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3233-3267">source</a><h4 class="code-header">fn <a href="#method.tail" class="fn">tail</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/collections/vec_deque/into_iter/struct.IntoIter.html" title="struct alloc::collections::vec_deque::into_iter::IntoIter">IntoIter</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <a href="#" class="tooltip" data-notable-ty="IntoIter&lt;Self::Item&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Consumes the iterator and return an iterator of the last <code>n</code> elements.</p>
<p>The iterator, if directly collected to a <code>VecDeque</code>, is converted
without any extra copying or allocation cost.
If directly collected to a <code>Vec</code>, it may need some data movement
but no re-allocation.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::{assert_equal, Itertools};
<span class="kw">let </span>v = <span class="macro">vec!</span>[<span class="number">5</span>, <span class="number">9</span>, <span class="number">8</span>, <span class="number">4</span>, <span class="number">2</span>, <span class="number">12</span>, <span class="number">0</span>];
assert_equal(v.iter().tail(<span class="number">3</span>), <span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">12</span>, <span class="number">0</span>]);
assert_equal(v.iter().tail(<span class="number">10</span>), <span class="kw-2">&amp;</span>v);
assert_equal(v.iter().tail(<span class="number">1</span>), v.iter().last());
assert_equal((<span class="number">0</span>..<span class="number">100</span>).tail(<span class="number">10</span>), <span class="number">90</span>..<span class="number">100</span>);
assert_equal((<span class="number">0</span>..<span class="number">100</span>).filter(|x| x % <span class="number">3 </span>== <span class="number">0</span>).tail(<span class="number">10</span>), (<span class="number">72</span>..<span class="number">100</span>).step_by(<span class="number">3</span>));</code></pre></div>
<p>For double ended iterators without side-effects, you might prefer
<code>.rev().take(n).rev()</code> to have a similar result (lazy and non-allocating)
without consuming the entire iterator.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.partition_map" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3290-3306">source</a><h4 class="code-header">fn <a href="#method.partition_map" class="fn">partition_map</a>&lt;A, B, F, L, R&gt;(self, predicate: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="enum.Either.html" title="enum itertools::Either">Either</a>&lt;L, R&gt;,
A: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;L&gt;,
B: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;R&gt;,</div></h4></section></summary><div class="docblock"><p>Collect all iterator elements into one of two
partitions. Unlike <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.partition" title="method core::iter::traits::iterator::Iterator::partition"><code>Iterator::partition</code></a>, each partition may
have a distinct type.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::{Itertools, Either};
<span class="kw">let </span>successes_and_failures = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">1</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Err</span>(<span class="bool-val">true</span>), <span class="prelude-val">Ok</span>(<span class="number">2</span>)];
<span class="kw">let </span>(successes, failures): (Vec&lt;<span class="kw">_</span>&gt;, Vec&lt;<span class="kw">_</span>&gt;) = successes_and_failures
.into_iter()
.partition_map(|r| {
<span class="kw">match </span>r {
<span class="prelude-val">Ok</span>(v) =&gt; Either::Left(v),
<span class="prelude-val">Err</span>(v) =&gt; Either::Right(v),
}
});
<span class="macro">assert_eq!</span>(successes, [<span class="number">1</span>, <span class="number">2</span>]);
<span class="macro">assert_eq!</span>(failures, [<span class="bool-val">false</span>, <span class="bool-val">true</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.partition_result" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3323-3333">source</a><h4 class="code-header">fn <a href="#method.partition_result" class="fn">partition_result</a>&lt;A, B, T, E&gt;(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, E&gt;&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;T&gt;,
B: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;E&gt;,</div></h4></section></summary><div class="docblock"><p>Partition a sequence of <code>Result</code>s into one list of all the <code>Ok</code> elements
and another list of all the <code>Err</code> elements.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>successes_and_failures = <span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">1</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>), <span class="prelude-val">Err</span>(<span class="bool-val">true</span>), <span class="prelude-val">Ok</span>(<span class="number">2</span>)];
<span class="kw">let </span>(successes, failures): (Vec&lt;<span class="kw">_</span>&gt;, Vec&lt;<span class="kw">_</span>&gt;) = successes_and_failures
.into_iter()
.partition_result();
<span class="macro">assert_eq!</span>(successes, [<span class="number">1</span>, <span class="number">2</span>]);
<span class="macro">assert_eq!</span>(failures, [<span class="bool-val">false</span>, <span class="bool-val">true</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_group_map" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3352-3358">source</a><h4 class="code-header">fn <a href="#method.into_group_map" class="fn">into_group_map</a>&lt;K, V&gt;(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;V&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(K, V)</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,</div></h4></section></summary><div class="docblock"><p>Return a <code>HashMap</code> of keys mapped to <code>Vec</code>s of values. Keys and values
are taken from <code>(Key, Value)</code> tuple pairs yielded by the input iterator.</p>
<p>Essentially a shorthand for <code>.into_grouping_map().collect::&lt;Vec&lt;_&gt;&gt;()</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>data = <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="number">10</span>), (<span class="number">2</span>, <span class="number">12</span>), (<span class="number">3</span>, <span class="number">13</span>), (<span class="number">0</span>, <span class="number">20</span>), (<span class="number">3</span>, <span class="number">33</span>), (<span class="number">2</span>, <span class="number">42</span>)];
<span class="kw">let </span>lookup = data.into_iter().into_group_map();
<span class="macro">assert_eq!</span>(lookup[<span class="kw-2">&amp;</span><span class="number">0</span>], <span class="macro">vec!</span>[<span class="number">10</span>, <span class="number">20</span>]);
<span class="macro">assert_eq!</span>(lookup.get(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(lookup[<span class="kw-2">&amp;</span><span class="number">2</span>], <span class="macro">vec!</span>[<span class="number">12</span>, <span class="number">42</span>]);
<span class="macro">assert_eq!</span>(lookup[<span class="kw-2">&amp;</span><span class="number">3</span>], <span class="macro">vec!</span>[<span class="number">13</span>, <span class="number">33</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_group_map_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3388-3395">source</a><h4 class="code-header">fn <a href="#method.into_group_map_by" class="fn">into_group_map_by</a>&lt;K, V, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;V&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = V&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;V</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return an <code>Iterator</code> on a <code>HashMap</code>. Keys mapped to <code>Vec</code>s of values. The key is specified
in the closure.</p>
<p>Essentially a shorthand for <code>.into_grouping_map_by(f).collect::&lt;Vec&lt;_&gt;&gt;()</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>std::collections::HashMap;
<span class="kw">let </span>data = <span class="macro">vec!</span>[(<span class="number">0</span>, <span class="number">10</span>), (<span class="number">2</span>, <span class="number">12</span>), (<span class="number">3</span>, <span class="number">13</span>), (<span class="number">0</span>, <span class="number">20</span>), (<span class="number">3</span>, <span class="number">33</span>), (<span class="number">2</span>, <span class="number">42</span>)];
<span class="kw">let </span>lookup: HashMap&lt;u32,Vec&lt;(u32, u32)&gt;&gt; =
data.clone().into_iter().into_group_map_by(|a| a.<span class="number">0</span>);
<span class="macro">assert_eq!</span>(lookup[<span class="kw-2">&amp;</span><span class="number">0</span>], <span class="macro">vec!</span>[(<span class="number">0</span>,<span class="number">10</span>),(<span class="number">0</span>,<span class="number">20</span>)]);
<span class="macro">assert_eq!</span>(lookup.get(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(lookup[<span class="kw-2">&amp;</span><span class="number">2</span>], <span class="macro">vec!</span>[(<span class="number">2</span>,<span class="number">12</span>), (<span class="number">2</span>,<span class="number">42</span>)]);
<span class="macro">assert_eq!</span>(lookup[<span class="kw-2">&amp;</span><span class="number">3</span>], <span class="macro">vec!</span>[(<span class="number">3</span>,<span class="number">13</span>), (<span class="number">3</span>,<span class="number">33</span>)]);
<span class="macro">assert_eq!</span>(
data.into_iter()
.into_group_map_by(|x| x.<span class="number">0</span>)
.into_iter()
.map(|(key, values)| (key, values.into_iter().fold(<span class="number">0</span>,|acc, (<span class="kw">_</span>,v)| acc + v )))
.collect::&lt;HashMap&lt;u32,u32&gt;&gt;()[<span class="kw-2">&amp;</span><span class="number">0</span>],
<span class="number">30</span>,
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_grouping_map" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3407-3413">source</a><h4 class="code-header">fn <a href="#method.into_grouping_map" class="fn">into_grouping_map</a>&lt;K, V&gt;(self) -&gt; <a class="struct" href="structs/struct.GroupingMap.html" title="struct itertools::structs::GroupingMap">GroupingMap</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(K, V)</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,</div></h4></section></summary><div class="docblock"><p>Constructs a <code>GroupingMap</code> to be used later with one of the efficient
group-and-fold operations it allows to perform.</p>
<p>The input iterator must yield item in the form of <code>(K, V)</code> where the
value of type <code>K</code> will be used as key to identify the groups and the
value of type <code>V</code> as value for the folding operation.</p>
<p>See <a href="structs/struct.GroupingMap.html" title="struct itertools::structs::GroupingMap"><code>GroupingMap</code></a> for more informations
on what operations are available.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_grouping_map_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3424-3431">source</a><h4 class="code-header">fn <a href="#method.into_grouping_map_by" class="fn">into_grouping_map_by</a>&lt;K, V, F&gt;(self, key_mapper: F) -&gt; <a class="type" href="structs/type.GroupingMapBy.html" title="type itertools::structs::GroupingMapBy">GroupingMapBy</a>&lt;Self, F&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = V&gt; + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;V</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Constructs a <code>GroupingMap</code> to be used later with one of the efficient
group-and-fold operations it allows to perform.</p>
<p>The values from this iterator will be used as values for the folding operation
while the keys will be obtained from the values by calling <code>key_mapper</code>.</p>
<p>See <a href="structs/struct.GroupingMap.html" title="struct itertools::structs::GroupingMap"><code>GroupingMap</code></a> for more informations
on what operations are available.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.min_set" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3456-3462">source</a><h4 class="code-header">fn <a href="#method.min_set" class="fn">min_set</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Return all minimum elements of an iterator.</p>
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().min_set(), Vec::&lt;<span class="kw-2">&amp;</span>i32&gt;::new());
<span class="kw">let </span>a = [<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().min_set(), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span><span class="number">1</span>]);
<span class="kw">let </span>a = [<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="macro">assert_eq!</span>(a.iter().min_set(), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span><span class="number">1</span>]);
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().min_set(), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>]);</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.min_set_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3489-3495">source</a><h4 class="code-header">fn <a href="#method.min_set_by" class="fn">min_set_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Return all minimum elements of an iterator, as determined by
the specified function.</p>
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [(i32, i32); <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().min_set_by(|<span class="kw">_</span>, <span class="kw">_</span>| Ordering::Equal), Vec::&lt;<span class="kw-2">&amp;</span>(i32, i32)&gt;::new());
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>)];
<span class="macro">assert_eq!</span>(a.iter().min_set_by(|&amp;&amp;(k1,<span class="kw">_</span>), &amp;&amp;(k2, <span class="kw">_</span>)| k1.cmp(<span class="kw-2">&amp;</span>k2)), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">2</span>), (<span class="number">3</span>, <span class="number">9</span>), (<span class="number">4</span>, <span class="number">8</span>), (<span class="number">5</span>, <span class="number">9</span>)];
<span class="macro">assert_eq!</span>(a.iter().min_set_by(|&amp;&amp;(<span class="kw">_</span>,k1), &amp;&amp;(<span class="kw">_</span>,k2)| k1.cmp(<span class="kw-2">&amp;</span>k2)), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>), <span class="kw-2">&amp;</span>(<span class="number">2</span>, <span class="number">2</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">1</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">4</span>), (<span class="number">1</span>, <span class="number">5</span>)];
<span class="macro">assert_eq!</span>(a.iter().min_set_by(|&amp;&amp;(k1,<span class="kw">_</span>), &amp;&amp;(k2, <span class="kw">_</span>)| k1.cmp(<span class="kw-2">&amp;</span>k2)), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">3</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">4</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">5</span>)]);</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.min_set_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3521-3528">source</a><h4 class="code-header">fn <a href="#method.min_set_by_key" class="fn">min_set_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return all minimum elements of an iterator, as determined by
the specified function.</p>
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [(i32, i32); <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().min_set_by_key(|<span class="kw">_</span>| ()), Vec::&lt;<span class="kw-2">&amp;</span>(i32, i32)&gt;::new());
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>)];
<span class="macro">assert_eq!</span>(a.iter().min_set_by_key(|&amp;&amp;(k,<span class="kw">_</span>)| k), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">2</span>), (<span class="number">3</span>, <span class="number">9</span>), (<span class="number">4</span>, <span class="number">8</span>), (<span class="number">5</span>, <span class="number">9</span>)];
<span class="macro">assert_eq!</span>(a.iter().min_set_by_key(|&amp;&amp;(<span class="kw">_</span>, k)| k), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>), <span class="kw-2">&amp;</span>(<span class="number">2</span>, <span class="number">2</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">1</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">4</span>), (<span class="number">1</span>, <span class="number">5</span>)];
<span class="macro">assert_eq!</span>(a.iter().min_set_by_key(|&amp;&amp;(k, <span class="kw">_</span>)| k), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">3</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">4</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">5</span>)]);</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_set" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3553-3559">source</a><h4 class="code-header">fn <a href="#method.max_set" class="fn">max_set</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Return all maximum elements of an iterator.</p>
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().max_set(), Vec::&lt;<span class="kw-2">&amp;</span>i32&gt;::new());
<span class="kw">let </span>a = [<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().max_set(), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span><span class="number">1</span>]);
<span class="kw">let </span>a = [<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="macro">assert_eq!</span>(a.iter().max_set(), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span><span class="number">5</span>]);
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().max_set(), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>]);</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_set_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3586-3592">source</a><h4 class="code-header">fn <a href="#method.max_set_by" class="fn">max_set_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Return all maximum elements of an iterator, as determined by
the specified function.</p>
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [(i32, i32); <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().max_set_by(|<span class="kw">_</span>, <span class="kw">_</span>| Ordering::Equal), Vec::&lt;<span class="kw-2">&amp;</span>(i32, i32)&gt;::new());
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>)];
<span class="macro">assert_eq!</span>(a.iter().max_set_by(|&amp;&amp;(k1,<span class="kw">_</span>), &amp;&amp;(k2, <span class="kw">_</span>)| k1.cmp(<span class="kw-2">&amp;</span>k2)), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">2</span>), (<span class="number">3</span>, <span class="number">9</span>), (<span class="number">4</span>, <span class="number">8</span>), (<span class="number">5</span>, <span class="number">9</span>)];
<span class="macro">assert_eq!</span>(a.iter().max_set_by(|&amp;&amp;(<span class="kw">_</span>,k1), &amp;&amp;(<span class="kw">_</span>,k2)| k1.cmp(<span class="kw-2">&amp;</span>k2)), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">3</span>, <span class="number">9</span>), <span class="kw-2">&amp;</span>(<span class="number">5</span>, <span class="number">9</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">1</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">4</span>), (<span class="number">1</span>, <span class="number">5</span>)];
<span class="macro">assert_eq!</span>(a.iter().max_set_by(|&amp;&amp;(k1,<span class="kw">_</span>), &amp;&amp;(k2, <span class="kw">_</span>)| k1.cmp(<span class="kw-2">&amp;</span>k2)), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">3</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">4</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">5</span>)]);</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_set_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3618-3625">source</a><h4 class="code-header">fn <a href="#method.max_set_by_key" class="fn">max_set_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return all maximum elements of an iterator, as determined by
the specified function.</p>
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [(i32, i32); <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().max_set_by_key(|<span class="kw">_</span>| ()), Vec::&lt;<span class="kw-2">&amp;</span>(i32, i32)&gt;::new());
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>)];
<span class="macro">assert_eq!</span>(a.iter().max_set_by_key(|&amp;&amp;(k,<span class="kw">_</span>)| k), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">2</span>), (<span class="number">3</span>, <span class="number">9</span>), (<span class="number">4</span>, <span class="number">8</span>), (<span class="number">5</span>, <span class="number">9</span>)];
<span class="macro">assert_eq!</span>(a.iter().max_set_by_key(|&amp;&amp;(<span class="kw">_</span>, k)| k), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">3</span>, <span class="number">9</span>), <span class="kw-2">&amp;</span>(<span class="number">5</span>, <span class="number">9</span>)]);
<span class="kw">let </span>a = [(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">1</span>, <span class="number">3</span>), (<span class="number">1</span>, <span class="number">4</span>), (<span class="number">1</span>, <span class="number">5</span>)];
<span class="macro">assert_eq!</span>(a.iter().max_set_by_key(|&amp;&amp;(k, <span class="kw">_</span>)| k), <span class="macro">vec!</span>[<span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">2</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">3</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">4</span>), <span class="kw-2">&amp;</span>(<span class="number">1</span>, <span class="number">5</span>)]);</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.minmax" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3662-3668">source</a><h4 class="code-header">fn <a href="#method.minmax" class="fn">minmax</a>(self) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class="docblock"><p>Return the minimum and maximum elements in the iterator.</p>
<p>The return type <code>MinMaxResult</code> is an enum of three variants:</p>
<ul>
<li><code>NoElements</code> if the iterator is empty.</li>
<li><code>OneElement(x)</code> if the iterator has exactly one element.</li>
<li><code>MinMax(x, y)</code> is returned otherwise, where <code>x &lt;= y</code>. Two
values are equal if and only if there is more than one
element in the iterator and all elements are equal.</li>
</ul>
<p>On an iterator of length <code>n</code>, <code>minmax</code> does <code>1.5 * n</code> comparisons,
and so is faster than calling <code>min</code> and <code>max</code> separately which does
<code>2 * n</code> comparisons.</p>
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::MinMaxResult::{NoElements, OneElement, MinMax};
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().minmax(), NoElements);
<span class="kw">let </span>a = [<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().minmax(), OneElement(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="kw">let </span>a = [<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="macro">assert_eq!</span>(a.iter().minmax(), MinMax(<span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">5</span>));
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().minmax(), MinMax(<span class="kw-2">&amp;</span><span class="number">1</span>, <span class="kw-2">&amp;</span><span class="number">1</span>));</code></pre></div>
<p>The elements can be floats but no particular result is guaranteed
if an element is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.minmax_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3681-3688">source</a><h4 class="code-header">fn <a href="#method.minmax_by_key" class="fn">minmax_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return the minimum and maximum element of an iterator, as determined by
the specified function.</p>
<p>The return value is a variant of <a href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult"><code>MinMaxResult</code></a> like for <a href="trait.Itertools.html#method.minmax" title="method itertools::Itertools::minmax"><code>.minmax()</code></a>.</p>
<p>For the minimum, the first minimal element is returned. For the maximum,
the last maximal element wins. This matches the behavior of the standard
<a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.min" title="method core::iter::traits::iterator::Iterator::min"><code>Iterator::min</code></a> and <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.max" title="method core::iter::traits::iterator::Iterator::max"><code>Iterator::max</code></a> methods.</p>
<p>The keys can be floats but no particular result is guaranteed
if a key is NaN.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.minmax_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3698-3704">source</a><h4 class="code-header">fn <a href="#method.minmax_by" class="fn">minmax_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Return the minimum and maximum element of an iterator, as determined by
the specified comparison function.</p>
<p>The return value is a variant of <a href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult"><code>MinMaxResult</code></a> like for <a href="trait.Itertools.html#method.minmax" title="method itertools::Itertools::minmax"><code>.minmax()</code></a>.</p>
<p>For the minimum, the first minimal element is returned. For the maximum,
the last maximal element wins. This matches the behavior of the standard
<a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.min" title="method core::iter::traits::iterator::Iterator::min"><code>Iterator::min</code></a> and <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.max" title="method core::iter::traits::iterator::Iterator::max"><code>Iterator::max</code></a> methods.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_max" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3725-3733">source</a><h4 class="code-header">fn <a href="#method.position_max" class="fn">position_max</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Return the position of the maximum element in the iterator.</p>
<p>If several elements are equally maximum, the position of the
last of them is returned.</p>
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_max(), <span class="prelude-val">None</span>);
<span class="kw">let </span>a = [-<span class="number">3</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_max(), <span class="prelude-val">Some</span>(<span class="number">3</span>));
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_max(), <span class="prelude-val">Some</span>(<span class="number">1</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_max_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3755-3764">source</a><h4 class="code-header">fn <a href="#method.position_max_by_key" class="fn">position_max_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return the position of the maximum element in the iterator, as
determined by the specified function.</p>
<p>If several elements are equally maximum, the position of the
last of them is returned.</p>
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_max_by_key(|x| x.abs()), <span class="prelude-val">None</span>);
<span class="kw">let </span>a = [-<span class="number">3_i32</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_max_by_key(|x| x.abs()), <span class="prelude-val">Some</span>(<span class="number">4</span>));
<span class="kw">let </span>a = [<span class="number">1_i32</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_max_by_key(|x| x.abs()), <span class="prelude-val">Some</span>(<span class="number">3</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_max_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3786-3794">source</a><h4 class="code-header">fn <a href="#method.position_max_by" class="fn">position_max_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Return the position of the maximum element in the iterator, as
determined by the specified comparison function.</p>
<p>If several elements are equally maximum, the position of the
last of them is returned.</p>
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_max_by(|x, y| x.cmp(y)), <span class="prelude-val">None</span>);
<span class="kw">let </span>a = [-<span class="number">3_i32</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_max_by(|x, y| x.cmp(y)), <span class="prelude-val">Some</span>(<span class="number">3</span>));
<span class="kw">let </span>a = [<span class="number">1_i32</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_max_by(|x, y| x.cmp(y)), <span class="prelude-val">Some</span>(<span class="number">1</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_min" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3815-3823">source</a><h4 class="code-header">fn <a href="#method.position_min" class="fn">position_min</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Return the position of the minimum element in the iterator.</p>
<p>If several elements are equally minimum, the position of the
first of them is returned.</p>
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_min(), <span class="prelude-val">None</span>);
<span class="kw">let </span>a = [-<span class="number">3</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_min(), <span class="prelude-val">Some</span>(<span class="number">4</span>));
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_min(), <span class="prelude-val">Some</span>(<span class="number">2</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_min_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3845-3854">source</a><h4 class="code-header">fn <a href="#method.position_min_by_key" class="fn">position_min_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return the position of the minimum element in the iterator, as
determined by the specified function.</p>
<p>If several elements are equally minimum, the position of the
first of them is returned.</p>
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_min_by_key(|x| x.abs()), <span class="prelude-val">None</span>);
<span class="kw">let </span>a = [-<span class="number">3_i32</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_min_by_key(|x| x.abs()), <span class="prelude-val">Some</span>(<span class="number">1</span>));
<span class="kw">let </span>a = [<span class="number">1_i32</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_min_by_key(|x| x.abs()), <span class="prelude-val">Some</span>(<span class="number">0</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_min_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3876-3884">source</a><h4 class="code-header">fn <a href="#method.position_min_by" class="fn">position_min_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Return the position of the minimum element in the iterator, as
determined by the specified comparison function.</p>
<p>If several elements are equally minimum, the position of the
first of them is returned.</p>
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_min_by(|x, y| x.cmp(y)), <span class="prelude-val">None</span>);
<span class="kw">let </span>a = [-<span class="number">3_i32</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_min_by(|x, y| x.cmp(y)), <span class="prelude-val">Some</span>(<span class="number">4</span>));
<span class="kw">let </span>a = [<span class="number">1_i32</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_min_by(|x, y| x.cmp(y)), <span class="prelude-val">Some</span>(<span class="number">2</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_minmax" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3928-3939">source</a><h4 class="code-header">fn <a href="#method.position_minmax" class="fn">position_minmax</a>(self) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class="docblock"><p>Return the positions of the minimum and maximum elements in
the iterator.</p>
<p>The return type <a href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult"><code>MinMaxResult</code></a> is an enum of three variants:</p>
<ul>
<li><code>NoElements</code> if the iterator is empty.</li>
<li><code>OneElement(xpos)</code> if the iterator has exactly one element.</li>
<li><code>MinMax(xpos, ypos)</code> is returned otherwise, where the
element at <code>xpos</code> ≤ the element at <code>ypos</code>. While the
referenced elements themselves may be equal, <code>xpos</code> cannot
be equal to <code>ypos</code>.</li>
</ul>
<p>On an iterator of length <code>n</code>, <code>position_minmax</code> does <code>1.5 * n</code>
comparisons, and so is faster than calling <code>position_min</code> and
<code>position_max</code> separately which does <code>2 * n</code> comparisons.</p>
<p>For the minimum, if several elements are equally minimum, the
position of the first of them is returned. For the maximum, if
several elements are equally maximum, the position of the last
of them is returned.</p>
<p>The elements can be floats but no particular result is
guaranteed if an element is NaN.</p>
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::MinMaxResult::{NoElements, OneElement, MinMax};
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_minmax(), NoElements);
<span class="kw">let </span>a = [<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax(), OneElement(<span class="number">0</span>));
<span class="kw">let </span>a = [-<span class="number">3</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax(), MinMax(<span class="number">4</span>, <span class="number">3</span>));
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax(), MinMax(<span class="number">2</span>, <span class="number">1</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_minmax_by_key" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#3975-3987">source</a><h4 class="code-header">fn <a href="#method.position_minmax_by_key" class="fn">position_minmax_by_key</a>&lt;K, F&gt;(self, key: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Return the postions of the minimum and maximum elements of an
iterator, as determined by the specified function.</p>
<p>The return value is a variant of <a href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult"><code>MinMaxResult</code></a> like for
<a href="trait.Itertools.html#method.position_minmax"><code>position_minmax</code></a>.</p>
<p>For the minimum, if several elements are equally minimum, the
position of the first of them is returned. For the maximum, if
several elements are equally maximum, the position of the last
of them is returned.</p>
<p>The keys can be floats but no particular result is guaranteed
if a key is NaN.</p>
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::MinMaxResult::{NoElements, OneElement, MinMax};
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by_key(|x| x.abs()), NoElements);
<span class="kw">let </span>a = [<span class="number">10_i32</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by_key(|x| x.abs()), OneElement(<span class="number">0</span>));
<span class="kw">let </span>a = [-<span class="number">3_i32</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by_key(|x| x.abs()), MinMax(<span class="number">1</span>, <span class="number">4</span>));
<span class="kw">let </span>a = [<span class="number">1_i32</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by_key(|x| x.abs()), MinMax(<span class="number">0</span>, <span class="number">3</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_minmax_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4020-4031">source</a><h4 class="code-header">fn <a href="#method.position_minmax_by" class="fn">position_minmax_by</a>&lt;F&gt;(self, compare: F) -&gt; <a class="enum" href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult">MinMaxResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, &amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Return the postions of the minimum and maximum elements of an
iterator, as determined by the specified comparison function.</p>
<p>The return value is a variant of <a href="enum.MinMaxResult.html" title="enum itertools::MinMaxResult"><code>MinMaxResult</code></a> like for
<a href="trait.Itertools.html#method.position_minmax"><code>position_minmax</code></a>.</p>
<p>For the minimum, if several elements are equally minimum, the
position of the first of them is returned. For the maximum, if
several elements are equally maximum, the position of the last
of them is returned.</p>
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">use </span>itertools::MinMaxResult::{NoElements, OneElement, MinMax};
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by(|x, y| x.cmp(y)), NoElements);
<span class="kw">let </span>a = [<span class="number">10_i32</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by(|x, y| x.cmp(y)), OneElement(<span class="number">0</span>));
<span class="kw">let </span>a = [-<span class="number">3_i32</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">5</span>, -<span class="number">10</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by(|x, y| x.cmp(y)), MinMax(<span class="number">4</span>, <span class="number">3</span>));
<span class="kw">let </span>a = [<span class="number">1_i32</span>, <span class="number">1</span>, -<span class="number">1</span>, -<span class="number">1</span>];
<span class="macro">assert_eq!</span>(a.iter().position_minmax_by(|x, y| x.cmp(y)), MinMax(<span class="number">2</span>, <span class="number">1</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.exactly_one" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4050-4064">source</a><h4 class="code-header">fn <a href="#method.exactly_one" class="fn">exactly_one</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, <a class="struct" href="structs/struct.ExactlyOneError.html" title="struct itertools::structs::ExactlyOneError">ExactlyOneError</a>&lt;Self&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>If the iterator yields exactly one element, that element will be returned, otherwise
an error will be returned containing an iterator that has the same output as the input
iterator.</p>
<p>This provides an additional layer of validation over just calling <code>Iterator::next()</code>.
If your assumption that there should only be one element yielded is false this provides
the opportunity to detect and handle that, preventing errors at a distance.</p>
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span>x| x == <span class="number">2</span>).exactly_one().unwrap(), <span class="number">2</span>);
<span class="macro">assert!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">1 </span>&amp;&amp; x &lt; <span class="number">4</span>).exactly_one().unwrap_err().eq(<span class="number">2</span>..<span class="number">4</span>));
<span class="macro">assert!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">1 </span>&amp;&amp; x &lt; <span class="number">5</span>).exactly_one().unwrap_err().eq(<span class="number">2</span>..<span class="number">5</span>));
<span class="macro">assert!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span><span class="kw">_</span>| <span class="bool-val">false</span>).exactly_one().unwrap_err().eq(<span class="number">0</span>..<span class="number">0</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.at_most_one" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4083-4097">source</a><h4 class="code-header">fn <a href="#method.at_most_one" class="fn">at_most_one</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;, <a class="struct" href="structs/struct.ExactlyOneError.html" title="struct itertools::structs::ExactlyOneError">ExactlyOneError</a>&lt;Self&gt;&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>If the iterator yields no elements, <code>Ok(None)</code> will be returned. If the iterator yields
exactly one element, that element will be returned, otherwise an error will be returned
containing an iterator that has the same output as the input iterator.</p>
<p>This provides an additional layer of validation over just calling <code>Iterator::next()</code>.
If your assumption that there should be at most one element yielded is false this provides
the opportunity to detect and handle that, preventing errors at a distance.</p>
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span>x| x == <span class="number">2</span>).at_most_one().unwrap(), <span class="prelude-val">Some</span>(<span class="number">2</span>));
<span class="macro">assert!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">1 </span>&amp;&amp; x &lt; <span class="number">4</span>).at_most_one().unwrap_err().eq(<span class="number">2</span>..<span class="number">4</span>));
<span class="macro">assert!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">1 </span>&amp;&amp; x &lt; <span class="number">5</span>).at_most_one().unwrap_err().eq(<span class="number">2</span>..<span class="number">5</span>));
<span class="macro">assert_eq!</span>((<span class="number">0</span>..<span class="number">10</span>).filter(|<span class="kw-2">&amp;</span><span class="kw">_</span>| <span class="bool-val">false</span>).at_most_one().unwrap(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.multipeek" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4114-4119">source</a><h4 class="code-header">fn <a href="#method.multipeek" class="fn">multipeek</a>(self) -&gt; <a class="struct" href="structs/struct.MultiPeek.html" title="struct itertools::structs::MultiPeek">MultiPeek</a>&lt;Self&gt; <a href="#" class="tooltip" data-notable-ty="MultiPeek&lt;Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>An iterator adaptor that allows the user to peek at multiple <code>.next()</code>
values without advancing the base iterator.</p>
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span><span class="kw-2">mut </span>iter = (<span class="number">0</span>..<span class="number">10</span>).multipeek();
<span class="macro">assert_eq!</span>(iter.peek(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">0</span>));
<span class="macro">assert_eq!</span>(iter.peek(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(iter.peek(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="number">0</span>));
<span class="macro">assert_eq!</span>(iter.peek(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.counts" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4135-4143">source</a><h4 class="code-header">fn <a href="#method.counts" class="fn">counts</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>, <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,</div></h4></section></summary><div class="docblock"><p>Collect the items in this iterator and return a <code>HashMap</code> which
contains each item that appears in the iterator and the number
of times it appears.</p>
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>counts = [<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">5</span>].into_iter().counts();
<span class="macro">assert_eq!</span>(counts[<span class="kw-2">&amp;</span><span class="number">1</span>], <span class="number">3</span>);
<span class="macro">assert_eq!</span>(counts[<span class="kw-2">&amp;</span><span class="number">3</span>], <span class="number">2</span>);
<span class="macro">assert_eq!</span>(counts[<span class="kw-2">&amp;</span><span class="number">5</span>], <span class="number">1</span>);
<span class="macro">assert_eq!</span>(counts.get(<span class="kw-2">&amp;</span><span class="number">0</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.counts_by" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4178-4185">source</a><h4 class="code-header">fn <a href="#method.counts_by" class="fn">counts_by</a>&lt;K, F&gt;(self, f: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
K: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
F: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; K,</div></h4></section></summary><div class="docblock"><p>Collect the items in this iterator and return a <code>HashMap</code> which
contains each item that appears in the iterator and the number
of times it appears,
determining identity using a keying function.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">struct </span>Character {
first_name: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
last_name: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
}
<span class="kw">let </span>characters =
<span class="macro">vec!</span>[
Character { first_name: <span class="string">"Amy"</span>, last_name: <span class="string">"Pond" </span>},
Character { first_name: <span class="string">"Amy"</span>, last_name: <span class="string">"Wong" </span>},
Character { first_name: <span class="string">"Amy"</span>, last_name: <span class="string">"Santiago" </span>},
Character { first_name: <span class="string">"James"</span>, last_name: <span class="string">"Bond" </span>},
Character { first_name: <span class="string">"James"</span>, last_name: <span class="string">"Sullivan" </span>},
Character { first_name: <span class="string">"James"</span>, last_name: <span class="string">"Norington" </span>},
Character { first_name: <span class="string">"James"</span>, last_name: <span class="string">"Kirk" </span>},
];
<span class="kw">let </span>first_name_frequency =
characters
.into_iter()
.counts_by(|c| c.first_name);
<span class="macro">assert_eq!</span>(first_name_frequency[<span class="string">"Amy"</span>], <span class="number">3</span>);
<span class="macro">assert_eq!</span>(first_name_frequency[<span class="string">"James"</span>], <span class="number">4</span>);
<span class="macro">assert_eq!</span>(first_name_frequency.contains_key(<span class="string">"Asha"</span>), <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.multiunzip" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4207-4212">source</a><h4 class="code-header">fn <a href="#method.multiunzip" class="fn">multiunzip</a>&lt;FromI&gt;(self) -&gt; FromI<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.MultiUnzip.html" title="trait itertools::MultiUnzip">MultiUnzip</a>&lt;FromI&gt;,</div></h4></section></summary><div class="docblock"><p>Converts an iterator of tuples into a tuple of containers.</p>
<p>It consumes an entire iterator of n-ary tuples, producing <code>n</code> collections, one for each
column.</p>
<p>This function is, in some sense, the opposite of <a href="fn.multizip.html" title="fn itertools::multizip"><code>multizip</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="kw">let </span>inputs = <span class="macro">vec!</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="number">7</span>, <span class="number">8</span>, <span class="number">9</span>)];
<span class="kw">let </span>(a, b, c): (Vec&lt;<span class="kw">_</span>&gt;, Vec&lt;<span class="kw">_</span>&gt;, Vec&lt;<span class="kw">_</span>&gt;) = inputs
.into_iter()
.multiunzip();
<span class="macro">assert_eq!</span>(a, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">4</span>, <span class="number">7</span>]);
<span class="macro">assert_eq!</span>(b, <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">5</span>, <span class="number">8</span>]);
<span class="macro">assert_eq!</span>(c, <span class="macro">vec!</span>[<span class="number">3</span>, <span class="number">6</span>, <span class="number">9</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_len" class="method"><a class="src rightside" href="../src/itertools/lib.rs.html#4230-4236">source</a><h4 class="code-header">fn <a href="#method.try_len" class="fn">try_len</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, (<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>, <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;)&gt;</h4></section></summary><div class="docblock"><p>Returns the length of the iterator if one exists.
Otherwise return <code>self.size_hint()</code>.</p>
<p>Fallible <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html#method.len" title="method core::iter::traits::exact_size::ExactSizeIterator::len"><code>ExactSizeIterator::len</code></a>.</p>
<p>Inherits guarantees and restrictions from <a href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#method.size_hint" title="method core::iter::traits::iterator::Iterator::size_hint"><code>Iterator::size_hint</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>itertools::Itertools;
<span class="macro">assert_eq!</span>([<span class="number">0</span>; <span class="number">10</span>].iter().try_len(), <span class="prelude-val">Ok</span>(<span class="number">10</span>));
<span class="macro">assert_eq!</span>((<span class="number">10</span>..<span class="number">15</span>).try_len(), <span class="prelude-val">Ok</span>(<span class="number">5</span>));
<span class="macro">assert_eq!</span>((<span class="number">15</span>..<span class="number">10</span>).try_len(), <span class="prelude-val">Ok</span>(<span class="number">0</span>));
<span class="macro">assert_eq!</span>((<span class="number">10</span>..).try_len(), <span class="prelude-val">Err</span>((usize::MAX, <span class="prelude-val">None</span>)));
<span class="macro">assert_eq!</span>((<span class="number">10</span>..<span class="number">15</span>).filter(|x| x % <span class="number">2 </span>== <span class="number">0</span>).try_len(), <span class="prelude-val">Err</span>((<span class="number">0</span>, <span class="prelude-val">Some</span>(<span class="number">5</span>))));</code></pre></div>
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.80.0/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Itertools-for-T" class="impl"><a class="src rightside" href="../src/itertools/lib.rs.html#4239">source</a><a href="#impl-Itertools-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Itertools.html" title="trait itertools::Itertools">Itertools</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></div><script src="../trait.impl/itertools/trait.Itertools.js" async></script><script type="text/json" id="notable-traits-data">{"Batching<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Batching.html\" title=\"struct itertools::structs::Batching\">Batching</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;B, F, I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Batching.html\" title=\"struct itertools::structs::Batching\">Batching</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.reference.html\">&amp;mut I</a>) -&gt; <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html\" title=\"enum core::option::Option\">Option</a>&lt;B&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = B;</div>","CircularTupleWindows<Self, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.CircularTupleWindows.html\" title=\"struct itertools::structs::CircularTupleWindows\">CircularTupleWindows</a>&lt;I, T&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, T&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.CircularTupleWindows.html\" title=\"struct itertools::structs::CircularTupleWindows\">CircularTupleWindows</a>&lt;I, T&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = T::Item&gt; + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,\n T: TupleCollect + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,\n T::Item: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","Combinations<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Combinations.html\" title=\"struct itertools::structs::Combinations\">Combinations</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Combinations.html\" title=\"struct itertools::structs::Combinations\">Combinations</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;;</div>","CombinationsWithReplacement<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.CombinationsWithReplacement.html\" title=\"struct itertools::structs::CombinationsWithReplacement\">CombinationsWithReplacement</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.CombinationsWithReplacement.html\" title=\"struct itertools::structs::CombinationsWithReplacement\">CombinationsWithReplacement</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;;</div>","FilterMapOk<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.FilterMapOk.html\" title=\"struct itertools::structs::FilterMapOk\">FilterMapOk</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F, T, U, E&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.FilterMapOk.html\" title=\"struct itertools::structs::FilterMapOk\">FilterMapOk</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a>&lt;T, E&gt;&gt;,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(T) -&gt; <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html\" title=\"enum core::option::Option\">Option</a>&lt;U&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a>&lt;U, E&gt;;</div>","FilterOk<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.FilterOk.html\" title=\"struct itertools::structs::FilterOk\">FilterOk</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F, T, E&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.FilterOk.html\" title=\"struct itertools::structs::FilterOk\">FilterOk</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a>&lt;T, E&gt;&gt;,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.reference.html\">&amp;T</a>) -&gt; <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a>&lt;T, E&gt;;</div>","FlattenOk<Self, T, E>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.FlattenOk.html\" title=\"struct itertools::structs::FlattenOk\">FlattenOk</a>&lt;I, T, E&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, T, E&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.FlattenOk.html\" title=\"struct itertools::structs::FlattenOk\">FlattenOk</a>&lt;I, T, E&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a>&lt;T, E&gt;&gt;,\n T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html\" title=\"trait core::iter::traits::collect::IntoIterator\">IntoIterator</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a>&lt;T::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item\" title=\"type core::iter::traits::collect::IntoIterator::Item\">Item</a>, E&gt;;</div>","Interleave<Self, J::IntoIter>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Interleave.html\" title=\"struct itertools::structs::Interleave\">Interleave</a>&lt;I, J&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, J&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Interleave.html\" title=\"struct itertools::structs::Interleave\">Interleave</a>&lt;I, J&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n J: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.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.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","InterleaveShortest<Self, J::IntoIter>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.InterleaveShortest.html\" title=\"struct itertools::structs::InterleaveShortest\">InterleaveShortest</a>&lt;I, J&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, J&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.InterleaveShortest.html\" title=\"struct itertools::structs::InterleaveShortest\">InterleaveShortest</a>&lt;I, J&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n J: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.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.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","IntersperseWith<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.IntersperseWith.html\" title=\"struct itertools::structs::IntersperseWith\">IntersperseWith</a>&lt;I, ElemF&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, ElemF&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.IntersperseWith.html\" title=\"struct itertools::structs::IntersperseWith\">IntersperseWith</a>&lt;I, ElemF&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n ElemF: IntersperseElement&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","IntoIter<Self::Item>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/collections/vec_deque/into_iter/struct.IntoIter.html\" title=\"struct alloc::collections::vec_deque::into_iter::IntoIter\">IntoIter</a>&lt;T, A&gt;</code></h3><pre><code><div class=\"where\">impl&lt;T, A&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/collections/vec_deque/into_iter/struct.IntoIter.html\" title=\"struct alloc::collections::vec_deque::into_iter::IntoIter\">IntoIter</a>&lt;T, A&gt;<div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/alloc/trait.Allocator.html\" title=\"trait core::alloc::Allocator\">Allocator</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","IntoIter<Self::Item>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html\" title=\"struct alloc::vec::into_iter::IntoIter\">IntoIter</a>&lt;T, A&gt;</code></h3><pre><code><div class=\"where\">impl&lt;T, A&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/into_iter/struct.IntoIter.html\" title=\"struct alloc::vec::into_iter::IntoIter\">IntoIter</a>&lt;T, A&gt;<div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/alloc/trait.Allocator.html\" title=\"trait core::alloc::Allocator\">Allocator</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.KMergeBy.html\" title=\"struct itertools::structs::KMergeBy\">KMergeBy</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.KMergeBy.html\" title=\"struct itertools::structs::KMergeBy\">KMergeBy</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: KMergePredicate&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","MergeBy<Self, J::IntoIter, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.MergeBy.html\" title=\"struct itertools::structs::MergeBy\">MergeBy</a>&lt;I, J, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, J, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.MergeBy.html\" title=\"struct itertools::structs::MergeBy\">MergeBy</a>&lt;I, J, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n J: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: OrderingOrBool&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>, J::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = F::MergeResult;</div>","MultiPeek<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.MultiPeek.html\" title=\"struct itertools::structs::MultiPeek\">MultiPeek</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.MultiPeek.html\" title=\"struct itertools::structs::MultiPeek\">MultiPeek</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","MultiProduct<<Self::Item as IntoIterator>::IntoIter>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.MultiProduct.html\" title=\"struct itertools::structs::MultiProduct\">MultiProduct</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.MultiProduct.html\" title=\"struct itertools::structs::MultiProduct\">MultiProduct</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;;</div>","PadUsing<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.PadUsing.html\" title=\"struct itertools::structs::PadUsing\">PadUsing</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.PadUsing.html\" title=\"struct itertools::structs::PadUsing\">PadUsing</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.usize.html\">usize</a>) -&gt; I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","PeekingTakeWhile<'_, Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.PeekingTakeWhile.html\" title=\"struct itertools::structs::PeekingTakeWhile\">PeekingTakeWhile</a>&lt;'a, I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.PeekingTakeWhile.html\" title=\"struct itertools::structs::PeekingTakeWhile\">PeekingTakeWhile</a>&lt;'a, I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"trait.PeekingNext.html\" title=\"trait itertools::PeekingNext\">PeekingNext</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(&amp;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>) -&gt; <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","Permutations<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Permutations.html\" title=\"struct itertools::structs::Permutations\">Permutations</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Permutations.html\" title=\"struct itertools::structs::Permutations\">Permutations</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;;</div>","Positions<Self, P>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Positions.html\" title=\"struct itertools::structs::Positions\">Positions</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Positions.html\" title=\"struct itertools::structs::Positions\">Positions</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>) -&gt; <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.usize.html\">usize</a>;</div>","Powerset<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Powerset.html\" title=\"struct itertools::structs::Powerset\">Powerset</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Powerset.html\" title=\"struct itertools::structs::Powerset\">Powerset</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;;</div>","Product<Self, J::IntoIter>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Product.html\" title=\"struct itertools::structs::Product\">Product</a>&lt;I, J&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, J&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Product.html\" title=\"struct itertools::structs::Product\">Product</a>&lt;I, J&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n J: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = (I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>, J::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>);</div>","TakeWhileInclusive<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.TakeWhileInclusive.html\" title=\"struct itertools::structs::TakeWhileInclusive\">TakeWhileInclusive</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.TakeWhileInclusive.html\" title=\"struct itertools::structs::TakeWhileInclusive\">TakeWhileInclusive</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(&amp;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>) -&gt; <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","TakeWhileRef<'_, Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.TakeWhileRef.html\" title=\"struct itertools::structs::TakeWhileRef\">TakeWhileRef</a>&lt;'a, I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a, I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.TakeWhileRef.html\" title=\"struct itertools::structs::TakeWhileRef\">TakeWhileRef</a>&lt;'a, I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(&amp;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>) -&gt; <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","TupleCombinations<Self, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.TupleCombinations.html\" title=\"struct itertools::structs::TupleCombinations\">TupleCombinations</a>&lt;I, T&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, T&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.TupleCombinations.html\" title=\"struct itertools::structs::TupleCombinations\">TupleCombinations</a>&lt;I, T&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n T: HasCombination&lt;I&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","TupleWindows<Self, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.TupleWindows.html\" title=\"struct itertools::structs::TupleWindows\">TupleWindows</a>&lt;I, T&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, T&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.TupleWindows.html\" title=\"struct itertools::structs::TupleWindows\">TupleWindows</a>&lt;I, T&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = T::Item&gt;,\n T: <a class=\"trait\" href=\"traits/trait.HomogeneousTuple.html\" title=\"trait itertools::traits::HomogeneousTuple\">HomogeneousTuple</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,\n T::Item: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","Tuples<Self, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Tuples.html\" title=\"struct itertools::structs::Tuples\">Tuples</a>&lt;I, T&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, T&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Tuples.html\" title=\"struct itertools::structs::Tuples\">Tuples</a>&lt;I, T&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = T::Item&gt;,\n T: <a class=\"trait\" href=\"traits/trait.HomogeneousTuple.html\" title=\"trait itertools::traits::HomogeneousTuple\">HomogeneousTuple</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>","Unique<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Unique.html\" title=\"struct itertools::structs::Unique\">Unique</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Unique.html\" title=\"struct itertools::structs::Unique\">Unique</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html\" title=\"trait core::hash::Hash\">Hash</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","UniqueBy<Self, V, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.UniqueBy.html\" title=\"struct itertools::structs::UniqueBy\">UniqueBy</a>&lt;I, V, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, V, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.UniqueBy.html\" title=\"struct itertools::structs::UniqueBy\">UniqueBy</a>&lt;I, V, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n V: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html\" title=\"trait core::hash::Hash\">Hash</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(&amp;I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>) -&gt; V,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","Update<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.Update.html\" title=\"struct itertools::structs::Update\">Update</a>&lt;I, F&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, F&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.Update.html\" title=\"struct itertools::structs::Update\">Update</a>&lt;I, F&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n F: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(&amp;mut I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>),</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>;</div>","WhileSome<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.WhileSome.html\" title=\"struct itertools::structs::WhileSome\">WhileSome</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, A&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.WhileSome.html\" title=\"struct itertools::structs::WhileSome\">WhileSome</a>&lt;I&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&lt;Item = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html\" title=\"enum core::option::Option\">Option</a>&lt;A&gt;&gt;,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = A;</div>","WithPosition<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.WithPosition.html\" title=\"struct itertools::structs::WithPosition\">WithPosition</a>&lt;I&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.WithPosition.html\" title=\"struct itertools::structs::WithPosition\">WithPosition</a>&lt;I&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = (<a class=\"enum\" href=\"enum.Position.html\" title=\"enum itertools::Position\">Position</a>, I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>);</div>","ZipEq<Self, J::IntoIter>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.ZipEq.html\" title=\"struct itertools::structs::ZipEq\">ZipEq</a>&lt;I, J&gt;</code></h3><pre><code><div class=\"where\">impl&lt;I, J&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.ZipEq.html\" title=\"struct itertools::structs::ZipEq\">ZipEq</a>&lt;I, J&gt;<div class=\"where\">where\n I: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n J: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = (I::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>, J::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>);</div>","ZipLongest<Self, J::IntoIter>":"<h3>Notable traits for <code><a class=\"struct\" href=\"structs/struct.ZipLongest.html\" title=\"struct itertools::structs::ZipLongest\">ZipLongest</a>&lt;T, U&gt;</code></h3><pre><code><div class=\"where\">impl&lt;T, U&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"structs/struct.ZipLongest.html\" title=\"struct itertools::structs::ZipLongest\">ZipLongest</a>&lt;T, U&gt;<div class=\"where\">where\n T: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,\n U: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"enum\" href=\"enum.EitherOrBoth.html\" title=\"enum itertools::EitherOrBoth\">EitherOrBoth</a>&lt;T::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>, U::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" title=\"type core::iter::traits::iterator::Iterator::Item\">Item</a>&gt;;</div>"}</script></section></div></main></body></html>