133 lines
34 KiB
HTML
133 lines
34 KiB
HTML
<!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="Traits for writing parallel programs using an iterator-style interface"><title>rayon::iter - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rayon" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module iter</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../rayon/index.html">rayon</a><span class="version">1.11.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module iter</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate rayon</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rayon</a></div><h1>Module <span>iter</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rayon/iter/mod.rs.html#1-3627">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Traits for writing parallel programs using an iterator-style interface</p>
|
||
<p>You will rarely need to interact with this module directly unless you have
|
||
need to name one of the iterator types.</p>
|
||
<p>Parallel iterators make it easy to write iterator-like chains that
|
||
execute in parallel: typically all you have to do is convert the
|
||
first <code>.iter()</code> (or <code>iter_mut()</code>, <code>into_iter()</code>, etc) method into
|
||
<code>par_iter()</code> (or <code>par_iter_mut()</code>, <code>into_par_iter()</code>, etc). For
|
||
example, to compute the sum of the squares of a sequence of
|
||
integers, one might write:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rayon::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">fn </span>sum_of_squares(input: <span class="kw-2">&</span>[i32]) -> i32 {
|
||
input.par_iter()
|
||
.map(|i| i * i)
|
||
.sum()
|
||
}</code></pre></div>
|
||
<p>Or, to increment all the integers in a slice, you could write:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rayon::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">fn </span>increment_all(input: <span class="kw-2">&mut </span>[i32]) {
|
||
input.par_iter_mut()
|
||
.for_each(|p| <span class="kw-2">*</span>p += <span class="number">1</span>);
|
||
}</code></pre></div>
|
||
<p>To use parallel iterators, first import the traits by adding
|
||
something like <code>use rayon::prelude::*</code> to your module. You can
|
||
then call <code>par_iter</code>, <code>par_iter_mut</code>, or <code>into_par_iter</code> to get a
|
||
parallel iterator. Like a <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">regular iterator</a>, parallel
|
||
iterators work by first constructing a computation and then
|
||
executing it.</p>
|
||
<p>In addition to <code>par_iter()</code> and friends, some types offer other
|
||
ways to create (or consume) parallel iterators:</p>
|
||
<ul>
|
||
<li>Slices (<code>&[T]</code>, <code>&mut [T]</code>) offer methods like <code>par_split</code> and
|
||
<code>par_windows</code>, as well as various parallel sorting
|
||
operations. See <a href="../slice/trait.ParallelSlice.html" title="trait rayon::slice::ParallelSlice">the <code>ParallelSlice</code> trait</a> for the full list.</li>
|
||
<li>Strings (<code>&str</code>) offer methods like <code>par_split</code> and <code>par_lines</code>.
|
||
See <a href="../str/trait.ParallelString.html" title="trait rayon::str::ParallelString">the <code>ParallelString</code> trait</a> for the full list.</li>
|
||
<li>Various collections offer <a href="trait.ParallelExtend.html" title="trait rayon::iter::ParallelExtend"><code>par_extend</code></a>, which grows a
|
||
collection given a parallel iterator. (If you don’t have a
|
||
collection to extend, you can use <a href="trait.ParallelIterator.html#method.collect" title="method rayon::iter::ParallelIterator::collect"><code>collect()</code></a> to create a new
|
||
one from scratch.)</li>
|
||
</ul>
|
||
<p>To see the full range of methods available on parallel iterators,
|
||
check out the <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a> and <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a>
|
||
traits.</p>
|
||
<p>If you’d like to build a custom parallel iterator, or to write your own
|
||
combinator, then check out the <a href="fn.split.html" title="fn rayon::iter::split">split</a> function and the <a href="plumbing/index.html" title="mod rayon::iter::plumbing">plumbing</a> module.</p>
|
||
<p>Note: Several of the <code>ParallelIterator</code> methods rely on a <code>Try</code> trait which
|
||
has been deliberately obscured from the public API. This trait is intended
|
||
to mirror the unstable <code>std::ops::Try</code> with implementations for <code>Option</code> and
|
||
<code>Result</code>, where <code>Some</code>/<code>Ok</code> values will let those iterators continue, but
|
||
<code>None</code>/<code>Err</code> values will exit early.</p>
|
||
<p>A note about object safety: It is currently <em>not</em> possible to wrap
|
||
a <code>ParallelIterator</code> (or any trait that depends on it) using a
|
||
<code>Box<dyn ParallelIterator></code> or other kind of dynamic allocation,
|
||
because <code>ParallelIterator</code> is <strong>not object-safe</strong>.
|
||
(This keeps the implementation simpler and allows extra optimizations.)</p>
|
||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="plumbing/index.html" title="mod rayon::iter::plumbing">plumbing</a></dt><dd>Traits and functions used to implement parallel iteration. These are
|
||
low-level details – users of parallel iterators should not need to
|
||
interact with them directly. See <a href="https://github.com/rayon-rs/rayon/blob/main/src/iter/plumbing/README.md">the <code>plumbing</code> README</a> for a general overview.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Chain.html" title="struct rayon::iter::Chain">Chain</a></dt><dd><code>Chain</code> is an iterator that joins <code>b</code> after <code>a</code> in one continuous iterator.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.chain" title="method rayon::iter::ParallelIterator::chain"><code>chain()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.Chunks.html" title="struct rayon::iter::Chunks">Chunks</a></dt><dd><code>Chunks</code> is an iterator that groups elements of an underlying iterator.</dd><dt><a class="struct" href="struct.Cloned.html" title="struct rayon::iter::Cloned">Cloned</a></dt><dd><code>Cloned</code> is an iterator that clones the elements of an underlying iterator.</dd><dt><a class="struct" href="struct.Copied.html" title="struct rayon::iter::Copied">Copied</a></dt><dd><code>Copied</code> is an iterator that copies the elements of an underlying iterator.</dd><dt><a class="struct" href="struct.Empty.html" title="struct rayon::iter::Empty">Empty</a></dt><dd>Iterator adaptor for <a href="fn.empty.html" title="fn rayon::iter::empty">the <code>empty()</code> function</a>.</dd><dt><a class="struct" href="struct.Enumerate.html" title="struct rayon::iter::Enumerate">Enumerate</a></dt><dd><code>Enumerate</code> is an iterator that returns the current count along with the element.
|
||
This struct is created by the <a href="trait.IndexedParallelIterator.html#method.enumerate" title="method rayon::iter::IndexedParallelIterator::enumerate"><code>enumerate()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.ExponentialBlocks.html" title="struct rayon::iter::ExponentialBlocks">Exponential<wbr>Blocks</a></dt><dd><code>ExponentialBlocks</code> is a parallel iterator that consumes itself as a sequence
|
||
of parallel blocks of increasing sizes (exponentially).</dd><dt><a class="struct" href="struct.Filter.html" title="struct rayon::iter::Filter">Filter</a></dt><dd><code>Filter</code> takes a predicate <code>filter_op</code> and filters out elements that match.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.filter" title="method rayon::iter::ParallelIterator::filter"><code>filter()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.FilterMap.html" title="struct rayon::iter::FilterMap">Filter<wbr>Map</a></dt><dd><code>FilterMap</code> creates an iterator that uses <code>filter_op</code> to both filter and map elements.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.filter_map" title="method rayon::iter::ParallelIterator::filter_map"><code>filter_map()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>.</dd><dt><a class="struct" href="struct.FlatMap.html" title="struct rayon::iter::FlatMap">FlatMap</a></dt><dd><code>FlatMap</code> maps each element to a parallel iterator, then flattens these iterators together.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.flat_map" title="method rayon::iter::ParallelIterator::flat_map"><code>flat_map()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.FlatMapIter.html" title="struct rayon::iter::FlatMapIter">Flat<wbr>MapIter</a></dt><dd><code>FlatMapIter</code> maps each element to a serial iterator, then flattens these iterators together.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.flat_map_iter" title="method rayon::iter::ParallelIterator::flat_map_iter"><code>flat_map_iter()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.Flatten.html" title="struct rayon::iter::Flatten">Flatten</a></dt><dd><code>Flatten</code> turns each element to a parallel iterator, then flattens these iterators
|
||
together. This struct is created by the <a href="trait.ParallelIterator.html#method.flatten" title="method rayon::iter::ParallelIterator::flatten"><code>flatten()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>.</dd><dt><a class="struct" href="struct.FlattenIter.html" title="struct rayon::iter::FlattenIter">Flatten<wbr>Iter</a></dt><dd><code>FlattenIter</code> turns each element to a serial iterator, then flattens these iterators
|
||
together. This struct is created by the <a href="trait.ParallelIterator.html#method.flatten_iter" title="method rayon::iter::ParallelIterator::flatten_iter"><code>flatten_iter()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>.</dd><dt><a class="struct" href="struct.Fold.html" title="struct rayon::iter::Fold">Fold</a></dt><dd><code>Fold</code> is an iterator that applies a function over an iterator producing a single value.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.fold" title="method rayon::iter::ParallelIterator::fold"><code>fold()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.FoldChunks.html" title="struct rayon::iter::FoldChunks">Fold<wbr>Chunks</a></dt><dd><code>FoldChunks</code> is an iterator that groups elements of an underlying iterator and applies a
|
||
function over them, producing a single value for each group.</dd><dt><a class="struct" href="struct.FoldChunksWith.html" title="struct rayon::iter::FoldChunksWith">Fold<wbr>Chunks<wbr>With</a></dt><dd><code>FoldChunksWith</code> is an iterator that groups elements of an underlying iterator and applies a
|
||
function over them, producing a single value for each group.</dd><dt><a class="struct" href="struct.FoldWith.html" title="struct rayon::iter::FoldWith">Fold<wbr>With</a></dt><dd><code>FoldWith</code> is an iterator that applies a function over an iterator producing a single value.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.fold_with" title="method rayon::iter::ParallelIterator::fold_with"><code>fold_with()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.Inspect.html" title="struct rayon::iter::Inspect">Inspect</a></dt><dd><code>Inspect</code> is an iterator that calls a function with a reference to each
|
||
element before yielding it.</dd><dt><a class="struct" href="struct.Interleave.html" title="struct rayon::iter::Interleave">Interleave</a></dt><dd><code>Interleave</code> is an iterator that interleaves elements of iterators
|
||
<code>i</code> and <code>j</code> in one continuous iterator. This struct is created by
|
||
the <a href="trait.IndexedParallelIterator.html#method.interleave" title="method rayon::iter::IndexedParallelIterator::interleave"><code>interleave()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.InterleaveShortest.html" title="struct rayon::iter::InterleaveShortest">Interleave<wbr>Shortest</a></dt><dd><code>InterleaveShortest</code> is an iterator that works similarly to
|
||
<code>Interleave</code>, but this version stops returning elements once one
|
||
of the iterators run out.</dd><dt><a class="struct" href="struct.Intersperse.html" title="struct rayon::iter::Intersperse">Intersperse</a></dt><dd><code>Intersperse</code> is an iterator that inserts a particular item between each
|
||
item of the adapted iterator. This struct is created by the
|
||
<a href="trait.ParallelIterator.html#method.intersperse" title="method rayon::iter::ParallelIterator::intersperse"><code>intersperse()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.IterBridge.html" title="struct rayon::iter::IterBridge">Iter<wbr>Bridge</a></dt><dd><code>IterBridge</code> is a parallel iterator that wraps a sequential iterator.</dd><dt><a class="struct" href="struct.Map.html" title="struct rayon::iter::Map">Map</a></dt><dd><code>Map</code> is an iterator that transforms the elements of an underlying iterator.</dd><dt><a class="struct" href="struct.MapInit.html" title="struct rayon::iter::MapInit">MapInit</a></dt><dd><code>MapInit</code> is an iterator that transforms the elements of an underlying iterator.</dd><dt><a class="struct" href="struct.MapWith.html" title="struct rayon::iter::MapWith">MapWith</a></dt><dd><code>MapWith</code> is an iterator that transforms the elements of an underlying iterator.</dd><dt><a class="struct" href="struct.MaxLen.html" title="struct rayon::iter::MaxLen">MaxLen</a></dt><dd><code>MaxLen</code> is an iterator that imposes a maximum length on iterator splits.
|
||
This struct is created by the <a href="trait.IndexedParallelIterator.html#method.with_max_len" title="method rayon::iter::IndexedParallelIterator::with_max_len"><code>with_max_len()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.MinLen.html" title="struct rayon::iter::MinLen">MinLen</a></dt><dd><code>MinLen</code> is an iterator that imposes a minimum length on iterator splits.
|
||
This struct is created by the <a href="trait.IndexedParallelIterator.html#method.with_min_len" title="method rayon::iter::IndexedParallelIterator::with_min_len"><code>with_min_len()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.MultiZip.html" title="struct rayon::iter::MultiZip">Multi<wbr>Zip</a></dt><dd><code>MultiZip</code> is an iterator that zips up a tuple of parallel iterators to
|
||
produce tuples of their items.</dd><dt><a class="struct" href="struct.Once.html" title="struct rayon::iter::Once">Once</a></dt><dd>Iterator adaptor for <a href="fn.once.html" title="fn rayon::iter::once">the <code>once()</code> function</a>.</dd><dt><a class="struct" href="struct.PanicFuse.html" title="struct rayon::iter::PanicFuse">Panic<wbr>Fuse</a></dt><dd><code>PanicFuse</code> is an adaptor that wraps an iterator with a fuse in case
|
||
of panics, to halt all threads as soon as possible.</dd><dt><a class="struct" href="struct.Positions.html" title="struct rayon::iter::Positions">Positions</a></dt><dd><code>Positions</code> takes a predicate <code>predicate</code> and filters out elements that match,
|
||
yielding their indices.</dd><dt><a class="struct" href="struct.Repeat.html" title="struct rayon::iter::Repeat">Repeat</a></dt><dd>Iterator adaptor for <a href="fn.repeat.html" title="fn rayon::iter::repeat">the <code>repeat()</code> function</a>.</dd><dt><a class="struct" href="struct.RepeatN.html" title="struct rayon::iter::RepeatN">RepeatN</a></dt><dd>Iterator adaptor for <a href="fn.repeat_n.html" title="fn rayon::iter::repeat_n">the <code>repeat_n()</code> function</a>.</dd><dt><a class="struct" href="struct.Rev.html" title="struct rayon::iter::Rev">Rev</a></dt><dd><code>Rev</code> is an iterator that produces elements in reverse order. This struct
|
||
is created by the <a href="trait.IndexedParallelIterator.html#method.rev" title="method rayon::iter::IndexedParallelIterator::rev"><code>rev()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.Skip.html" title="struct rayon::iter::Skip">Skip</a></dt><dd><code>Skip</code> is an iterator that skips over the first <code>n</code> elements.
|
||
This struct is created by the <a href="trait.IndexedParallelIterator.html#method.skip" title="method rayon::iter::IndexedParallelIterator::skip"><code>skip()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.SkipAny.html" title="struct rayon::iter::SkipAny">SkipAny</a></dt><dd><code>SkipAny</code> is an iterator that skips over <code>n</code> elements from anywhere in <code>I</code>.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.skip_any" title="method rayon::iter::ParallelIterator::skip_any"><code>skip_any()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.SkipAnyWhile.html" title="struct rayon::iter::SkipAnyWhile">Skip<wbr>AnyWhile</a></dt><dd><code>SkipAnyWhile</code> is an iterator that skips over elements from anywhere in <code>I</code>
|
||
until the callback returns <code>false</code>.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.skip_any_while" title="method rayon::iter::ParallelIterator::skip_any_while"><code>skip_any_while()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.Split.html" title="struct rayon::iter::Split">Split</a></dt><dd><code>Split</code> is a parallel iterator using arbitrary data and a splitting function.
|
||
This struct is created by the <a href="fn.split.html" title="fn rayon::iter::split"><code>split()</code></a> function.</dd><dt><a class="struct" href="struct.StepBy.html" title="struct rayon::iter::StepBy">StepBy</a></dt><dd><code>StepBy</code> is an iterator that skips <code>n</code> elements between each yield, where <code>n</code> is the given step.
|
||
This struct is created by the <a href="trait.IndexedParallelIterator.html#method.step_by" title="method rayon::iter::IndexedParallelIterator::step_by"><code>step_by()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.Take.html" title="struct rayon::iter::Take">Take</a></dt><dd><code>Take</code> is an iterator that iterates over the first <code>n</code> elements.
|
||
This struct is created by the <a href="trait.IndexedParallelIterator.html#method.take" title="method rayon::iter::IndexedParallelIterator::take"><code>take()</code></a> method on <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.TakeAny.html" title="struct rayon::iter::TakeAny">TakeAny</a></dt><dd><code>TakeAny</code> is an iterator that iterates over <code>n</code> elements from anywhere in <code>I</code>.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.take_any" title="method rayon::iter::ParallelIterator::take_any"><code>take_any()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.TakeAnyWhile.html" title="struct rayon::iter::TakeAnyWhile">Take<wbr>AnyWhile</a></dt><dd><code>TakeAnyWhile</code> is an iterator that iterates over elements from anywhere in <code>I</code>
|
||
until the callback returns <code>false</code>.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.take_any_while" title="method rayon::iter::ParallelIterator::take_any_while"><code>take_any_while()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.TryFold.html" title="struct rayon::iter::TryFold">TryFold</a></dt><dd><code>TryFold</code> is an iterator that applies a function over an iterator producing a single value.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.try_fold" title="method rayon::iter::ParallelIterator::try_fold"><code>try_fold()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.TryFoldWith.html" title="struct rayon::iter::TryFoldWith">TryFold<wbr>With</a></dt><dd><code>TryFoldWith</code> is an iterator that applies a function over an iterator producing a single value.
|
||
This struct is created by the <a href="trait.ParallelIterator.html#method.try_fold_with" title="method rayon::iter::ParallelIterator::try_fold_with"><code>try_fold_with()</code></a> method on <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a></dd><dt><a class="struct" href="struct.UniformBlocks.html" title="struct rayon::iter::UniformBlocks">Uniform<wbr>Blocks</a></dt><dd><code>UniformBlocks</code> is a parallel iterator that consumes itself as a sequence
|
||
of parallel blocks of constant sizes.</dd><dt><a class="struct" href="struct.Update.html" title="struct rayon::iter::Update">Update</a></dt><dd><code>Update</code> is an iterator that mutates the elements of an
|
||
underlying iterator before they are yielded.</dd><dt><a class="struct" href="struct.WalkTree.html" title="struct rayon::iter::WalkTree">Walk<wbr>Tree</a></dt><dd>ParallelIterator for arbitrary tree-shaped patterns.
|
||
Returned by the <a href="fn.walk_tree.html" title="fn rayon::iter::walk_tree"><code>walk_tree()</code></a> function.</dd><dt><a class="struct" href="struct.WalkTreePostfix.html" title="struct rayon::iter::WalkTreePostfix">Walk<wbr>Tree<wbr>Postfix</a></dt><dd>ParallelIterator for arbitrary tree-shaped patterns.
|
||
Returned by the <a href="fn.walk_tree_postfix.html" title="fn rayon::iter::walk_tree_postfix"><code>walk_tree_postfix()</code></a> function.</dd><dt><a class="struct" href="struct.WalkTreePrefix.html" title="struct rayon::iter::WalkTreePrefix">Walk<wbr>Tree<wbr>Prefix</a></dt><dd>ParallelIterator for arbitrary tree-shaped patterns.
|
||
Returned by the <a href="fn.walk_tree_prefix.html" title="fn rayon::iter::walk_tree_prefix"><code>walk_tree_prefix()</code></a> function.</dd><dt><a class="struct" href="struct.WhileSome.html" title="struct rayon::iter::WhileSome">While<wbr>Some</a></dt><dd><code>WhileSome</code> is an iterator that yields the <code>Some</code> elements of an iterator,
|
||
halting as soon as any <code>None</code> is produced.</dd><dt><a class="struct" href="struct.Zip.html" title="struct rayon::iter::Zip">Zip</a></dt><dd><code>Zip</code> is an iterator that zips up <code>a</code> and <code>b</code> into a single iterator
|
||
of pairs. This struct is created by the <a href="trait.IndexedParallelIterator.html#method.zip" title="method rayon::iter::IndexedParallelIterator::zip"><code>zip()</code></a> method on
|
||
<a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a></dd><dt><a class="struct" href="struct.ZipEq.html" title="struct rayon::iter::ZipEq">ZipEq</a></dt><dd>An <a href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator"><code>IndexedParallelIterator</code></a> that iterates over two parallel iterators of equal
|
||
length simultaneously.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Either.html" title="enum rayon::iter::Either">Either</a></dt><dd>The enum <code>Either</code> with variants <code>Left</code> and <code>Right</code> is a general purpose
|
||
sum type with two cases.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.FromParallelIterator.html" title="trait rayon::iter::FromParallelIterator">From<wbr>Parallel<wbr>Iterator</a></dt><dd><code>FromParallelIterator</code> implements the creation of a collection
|
||
from a <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>. By implementing
|
||
<code>FromParallelIterator</code> for a given type, you define how it will be
|
||
created from an iterator.</dd><dt><a class="trait" href="trait.IndexedParallelIterator.html" title="trait rayon::iter::IndexedParallelIterator">Indexed<wbr>Parallel<wbr>Iterator</a></dt><dd>An iterator that supports “random access” to its data, meaning
|
||
that you can split it at arbitrary indices and draw data from
|
||
those points.</dd><dt><a class="trait" href="trait.IntoParallelIterator.html" title="trait rayon::iter::IntoParallelIterator">Into<wbr>Parallel<wbr>Iterator</a></dt><dd><code>IntoParallelIterator</code> implements the conversion to a <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>.</dd><dt><a class="trait" href="trait.IntoParallelRefIterator.html" title="trait rayon::iter::IntoParallelRefIterator">Into<wbr>Parallel<wbr>RefIterator</a></dt><dd><code>IntoParallelRefIterator</code> implements the conversion to a
|
||
<a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>, providing shared references to the data.</dd><dt><a class="trait" href="trait.IntoParallelRefMutIterator.html" title="trait rayon::iter::IntoParallelRefMutIterator">Into<wbr>Parallel<wbr>RefMut<wbr>Iterator</a></dt><dd><code>IntoParallelRefMutIterator</code> implements the conversion to a
|
||
<a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>, providing mutable references to the data.</dd><dt><a class="trait" href="trait.ParallelBridge.html" title="trait rayon::iter::ParallelBridge">Parallel<wbr>Bridge</a></dt><dd>Conversion trait to convert an <code>Iterator</code> to a <code>ParallelIterator</code>.</dd><dt><a class="trait" href="trait.ParallelDrainFull.html" title="trait rayon::iter::ParallelDrainFull">Parallel<wbr>Drain<wbr>Full</a></dt><dd><code>ParallelDrainFull</code> creates a parallel iterator that moves all items
|
||
from a collection while retaining the original capacity.</dd><dt><a class="trait" href="trait.ParallelDrainRange.html" title="trait rayon::iter::ParallelDrainRange">Parallel<wbr>Drain<wbr>Range</a></dt><dd><code>ParallelDrainRange</code> creates a parallel iterator that moves a range of items
|
||
from a collection while retaining the original capacity.</dd><dt><a class="trait" href="trait.ParallelExtend.html" title="trait rayon::iter::ParallelExtend">Parallel<wbr>Extend</a></dt><dd><code>ParallelExtend</code> extends an existing collection with items from a <a href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator"><code>ParallelIterator</code></a>.</dd><dt><a class="trait" href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator">Parallel<wbr>Iterator</a></dt><dd>Parallel version of the standard iterator trait.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.empty.html" title="fn rayon::iter::empty">empty</a></dt><dd>Creates a parallel iterator that produces nothing.</dd><dt><a class="fn" href="fn.once.html" title="fn rayon::iter::once">once</a></dt><dd>Creates a parallel iterator that produces an element exactly once.</dd><dt><a class="fn" href="fn.repeat.html" title="fn rayon::iter::repeat">repeat</a></dt><dd>Creates a parallel iterator that endlessly repeats <code>element</code> (by
|
||
cloning it). Note that this iterator has “infinite” length, so
|
||
typically you would want to use <code>zip</code> or <code>take</code> or some other
|
||
means to shorten it, or consider using
|
||
<a href="fn.repeat_n.html" title="fn rayon::iter::repeat_n">the <code>repeat_n()</code> function</a> instead.</dd><dt><a class="fn" href="fn.repeat_n.html" title="fn rayon::iter::repeat_n">repeat_<wbr>n</a></dt><dd>Creates a parallel iterator that produces <code>n</code> repeats of <code>element</code>
|
||
(by cloning it).</dd><dt><a class="fn" href="fn.repeatn.html" title="fn rayon::iter::repeatn">repeatn</a><wbr><span class="stab deprecated" title="">Deprecated</span></dt><dd>Creates a parallel iterator that produces <code>n</code> repeats of <code>element</code>
|
||
(by cloning it).</dd><dt><a class="fn" href="fn.split.html" title="fn rayon::iter::split">split</a></dt><dd>The <code>split</code> function takes arbitrary data and a closure that knows how to
|
||
split it, and turns this into a <code>ParallelIterator</code>.</dd><dt><a class="fn" href="fn.walk_tree.html" title="fn rayon::iter::walk_tree">walk_<wbr>tree</a></dt><dd>Create a tree like parallel iterator from an initial root node.
|
||
The <code>children_of</code> function should take a node and iterate on all of its child nodes.
|
||
The best parallelization is obtained when the tree is balanced
|
||
but we should also be able to handle harder cases.</dd><dt><a class="fn" href="fn.walk_tree_postfix.html" title="fn rayon::iter::walk_tree_postfix">walk_<wbr>tree_<wbr>postfix</a></dt><dd>Create a tree like postfix parallel iterator from an initial root node.
|
||
The <code>children_of</code> function should take a node and iterate on all of its child nodes.
|
||
The best parallelization is obtained when the tree is balanced
|
||
but we should also be able to handle harder cases.</dd><dt><a class="fn" href="fn.walk_tree_prefix.html" title="fn rayon::iter::walk_tree_prefix">walk_<wbr>tree_<wbr>prefix</a></dt><dd>Create a tree-like prefix parallel iterator from an initial root node.
|
||
The <code>children_of</code> function should take a node and return an iterator over its child nodes.
|
||
The best parallelization is obtained when the tree is balanced
|
||
but we should also be able to handle harder cases.</dd></dl></section></div></main></body></html> |