|
|
|
|
<!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="API documentation for the Rust `iter` mod in crate `rayon`."><meta name="keywords" content="rust, rustlang, rust-lang, iter"><title>rayon::iter - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../rayon/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module iter</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'><a href='../index.html'>rayon</a></p><script>window.sidebarCurrent = {name: 'iter', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../src/rayon/iter/mod.rs.html#1-2731' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>rayon</a>::<wbr><a class="mod" href=''>iter</a></span></h1><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">
|
|
|
|
|
<span class="kw">use</span> <span class="ident">rayon</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
|
|
<span class="kw">fn</span> <span class="ident">sum_of_squares</span>(<span class="ident">input</span>: <span class="kw-2">&</span>[<span class="ident">i32</span>]) <span class="op">-</span><span class="op">></span> <span class="ident">i32</span> {
|
|
|
|
|
<span class="ident">input</span>.<span class="ident">par_iter</span>()
|
|
|
|
|
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">i</span><span class="op">|</span> <span class="ident">i</span> <span class="op">*</span> <span class="ident">i</span>)
|
|
|
|
|
.<span class="ident">sum</span>()
|
|
|
|
|
}</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">
|
|
|
|
|
<span class="kw">use</span> <span class="ident">rayon</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|
|
|
|
<span class="kw">fn</span> <span class="ident">increment_all</span>(<span class="ident">input</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> [<span class="ident">i32</span>]) {
|
|
|
|
|
<span class="ident">input</span>.<span class="ident">par_iter_mut</span>()
|
|
|
|
|
.<span class="ident">for_each</span>(<span class="op">|</span><span class="ident">p</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">p</span> <span class="op">+</span><span class="op">=</span> <span class="number">1</span>);
|
|
|
|
|
}</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="http://doc.rust-lang.org/std/iter/trait.Iterator.html">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">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">the <code>ParallelString</code> trait</a> for the full list.</li>
|
|
|
|
|
<li>Various collections offer <a href="trait.ParallelExtend.html"><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"><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"><code>ParallelIterator</code></a> and <a href="trait.IndexedParallelIterator.html"><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">split</a> function and the <a href="plumbing/index.html">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>
|
|
|
|
|
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="mod" href="plumbing/index.html" title='rayon::iter::plumbing mod'>plumbing</a></td><td class='docblock-short'><p>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/master/src/iter/plumbing/README.md">the <code>plumbing</code> README</a> for a high-level overview.</p>
|
|
|
|
|
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="struct" href="struct.Chain.html" title='rayon::iter::Chain struct'>Chain</a></td><td class='docblock-short'><p><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"><code>chain()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Chunks.html" title='rayon::iter::Chunks struct'>Chunks</a></td><td class='docblock-short'><p><code>Chunks</code> is an iterator that groups elements of an underlying iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Cloned.html" title='rayon::iter::Cloned struct'>Cloned</a></td><td class='docblock-short'><p><code>Cloned</code> is an iterator that clones the elements of an underlying iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Empty.html" title='rayon::iter::Empty struct'>Empty</a></td><td class='docblock-short'><p>Iterator adaptor for <a href="fn.empty.html">the <code>empty()</code> function</a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Enumerate.html" title='rayon::iter::Enumerate struct'>Enumerate</a></td><td class='docblock-short'><p><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"><code>enumerate()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Filter.html" title='rayon::iter::Filter struct'>Filter</a></td><td class='docblock-short'><p><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"><code>filter()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.FilterMap.html" title='rayon::iter::FilterMap struct'>FilterMap</a></td><td class='docblock-short'><p><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"><code>filter_map()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.FlatMap.html" title='rayon::iter::FlatMap struct'>FlatMap</a></td><td class='docblock-short'><p><code>FlatMap</code> maps each element to an iterator, then flattens these iterators together.
|
|
|
|
|
This struct is created by the <a href="trait.ParallelIterator.html#method.flat_map"><code>flat_map()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Flatten.html" title='rayon::iter::Flatten struct'>Flatten</a></td><td class='docblock-short'><p><code>Flatten</code> turns each element to an iterator, then flattens these iterators
|
|
|
|
|
together. This struct is created by the <a href="trait.ParallelIterator.html#method.flatten"><code>flatten()</code></a> method on
|
|
|
|
|
<a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Fold.html" title='rayon::iter::Fold struct'>Fold</a></td><td class='docblock-short'><p><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"><code>fold()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.FoldWith.html" title='rayon::iter::FoldWith struct'>FoldWith</a></td><td class='docblock-short'><p><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"><code>fold_with()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Inspect.html" title='rayon::iter::Inspect struct'>Inspect</a></td><td class='docblock-short'><p><code>Inspect</code> is an iterator that calls a function with a reference to each
|
|
|
|
|
element before yielding it.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Interleave.html" title='rayon::iter::Interleave struct'>Interleave</a></td><td class='docblock-short'><p><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"><code>interleave()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.InterleaveShortest.html" title='rayon::iter::InterleaveShortest struct'>InterleaveShortest</a></td><td class='docblock-short'><p><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.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Intersperse.html" title='rayon::iter::Intersperse struct'>Intersperse</a></td><td class='docblock-short'><p><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"><code>intersperse()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.IterBridge.html" title='rayon::iter::IterBridge struct'>IterBridge</a></td><td class='docblock-short'><p><code>IterBridge</code> is a parallel iterator that wraps a sequential iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Map.html" title='rayon::iter::Map struct'>Map</a></td><td class='docblock-short'><p><code>Map</code> is an iterator that transforms the elements of an underlying iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MapInit.html" title='rayon::iter::MapInit struct'>MapInit</a></td><td class='docblock-short'><p><code>MapInit</code> is an iterator that transforms the elements of an underlying iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MapWith.html" title='rayon::iter::MapWith struct'>MapWith</a></td><td class='docblock-short'><p><code>MapWith</code> is an iterator that transforms the elements of an underlying iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MaxLen.html" title='rayon::iter::MaxLen struct'>MaxLen</a></td><td class='docblock-short'><p><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.max_len"><code>max_len()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MinLen.html" title='rayon::iter::MinLen struct'>MinLen</a></td><td class='docblock-short'><p><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.min_len"><code>min_len()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Once.html" title='rayon::iter::Once struct'>Once</a></td><td class='docblock-short'><p>Iterator adaptor for <a href="fn.once.html">the <code>once()</code> function</a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.PanicFuse.html" title='rayon::iter::PanicFuse struct'>PanicFuse</a></td><td class='docblock-short'><p><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.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Repeat.html" title='rayon::iter::Repeat struct'>Repeat</a></td><td class='docblock-short'><p>Iterator adaptor for <a href="fn.repeat.html">the <code>repeat()</code> function</a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.RepeatN.html" title='rayon::iter::RepeatN struct'>RepeatN</a></td><td class='docblock-short'><p>Iterator adaptor for <a href="fn.repeatn.html">the <code>repeatn()</code> function</a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Rev.html" title='rayon::iter::Rev struct'>Rev</a></td><td class='docblock-short'><p><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"><code>rev()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Skip.html" title='rayon::iter::Skip struct'>Skip</a></td><td class='docblock-short'><p><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"><code>skip()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Split.html" title='rayon::iter::Split struct'>Split</a></td><td class='docblock-short'><p><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"><code>split()</code></a> function.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Take.html" title='rayon::iter::Take struct'>Take</a></td><td class='docblock-short'><p><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"><code>take()</code></a> method on <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.TryFold.html" title='rayon::iter::TryFold struct'>TryFold</a></td><td class='docblock-short'><p><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"><code>try_fold()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.TryFoldWith.html" title='rayon::iter::TryFoldWith struct'>TryFoldWith</a></td><td class='docblock-short'><p><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"><code>try_fold_with()</code></a> method on <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Update.html" title='rayon::iter::Update struct'>Update</a></td><td class='docblock-short'><p><code>Update</code> is an iterator that mutates the elements of an
|
|
|
|
|
underlying iterator before they are yielded.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.WhileSome.html" title='rayon::iter::WhileSome struct'>WhileSome</a></td><td class='docblock-short'><p><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.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Zip.html" title='rayon::iter::Zip struct'>Zip</a></td><td class='docblock-short'><p><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"><code>zip()</code></a> method on
|
|
|
|
|
<a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="struct" href="struct.ZipEq.html" title='rayon::iter::ZipEq struct'>ZipEq</a></td><td class='docblock-short'><p>An <a href="trait.IndexedParallelIterator.html"><code>IndexedParallelIterator</code></a> that iterates over two parallel iterators of equal
|
|
|
|
|
length simultaneously.</p>
|
|
|
|
|
</td></tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="enum" href="enum.Either.html" title='rayon::iter::Either enum'>Either</a></td><td class='docblock-short'><p>The enum <code>Either</code> with variants <code>Left</code> and <code>Right</code> is a general purpose
|
|
|
|
|
sum type with two cases.</p>
|
|
|
|
|
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="trait" href="trait.FromParallelIterator.html" title='rayon::iter::FromParallelIterator trait'>FromParallelIterator</a></td><td class='docblock-short'><p><code>FromParallelIterator</code> implements the creation of a collection
|
|
|
|
|
from a <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>. By implementing
|
|
|
|
|
<code>FromParallelIterator</code> for a given type, you define how it will be
|
|
|
|
|
created from an iterator.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IndexedParallelIterator.html" title='rayon::iter::IndexedParallelIterator trait'>IndexedParallelIterator</a></td><td class='docblock-short'><p>An iterator that supports "random access" to its data, meaning
|
|
|
|
|
that you can split it at arbitrary indices and draw data from
|
|
|
|
|
those points.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IntoParallelIterator.html" title='rayon::iter::IntoParallelIterator trait'>IntoParallelIterator</a></td><td class='docblock-short'><p><code>IntoParallelIterator</code> implements the conversion to a <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IntoParallelRefIterator.html" title='rayon::iter::IntoParallelRefIterator trait'>IntoParallelRefIterator</a></td><td class='docblock-short'><p><code>IntoParallelRefIterator</code> implements the conversion to a
|
|
|
|
|
<a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>, providing shared references to the data.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IntoParallelRefMutIterator.html" title='rayon::iter::IntoParallelRefMutIterator trait'>IntoParallelRefMutIterator</a></td><td class='docblock-short'><p><code>IntoParallelRefMutIterator</code> implements the conversion to a
|
|
|
|
|
<a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>, providing mutable references to the data.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.ParallelBridge.html" title='rayon::iter::ParallelBridge trait'>ParallelBridge</a></td><td class='docblock-short'><p>Conversion trait to convert an <code>Iterator</code> to a <code>ParallelIterator</code>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.ParallelExtend.html" title='rayon::iter::ParallelExtend trait'>ParallelExtend</a></td><td class='docblock-short'><p><code>ParallelExtend</code> extends an existing collection with items from a <a href="trait.ParallelIterator.html"><code>ParallelIterator</code></a>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.ParallelIterator.html" title='rayon::iter::ParallelIterator trait'>ParallelIterator</a></td><td class='docblock-short'><p>Parallel version of the standard iterator trait.</p>
|
|
|
|
|
</td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="fn" href="fn.empty.html" title='rayon::iter::empty fn'>empty</a></td><td class='docblock-short'><p>Creates a parallel iterator that produces nothing.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.once.html" title='rayon::iter::once fn'>once</a></td><td class='docblock-short'><p>Creates a parallel iterator that produces an element exactly once.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.repeat.html" title='rayon::iter::repeat fn'>repeat</a></td><td class='docblock-short'><p>Creates a parallel iterator that endlessly repeats <code>elt</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.repeatn.html">the <code>repeatn()</code> function</a> instead.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.repeatn.html" title='rayon::iter::repeatn fn'>repeatn</a></td><td class='docblock-short'><p>Creates a parallel iterator that produces <code>n</code> repeats of <code>elt</code>
|
|
|
|
|
(by cloning it).</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.split.html" title='rayon::iter::split fn'>split</a></td><td class='docblock-short'><p>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>.</p>
|
|
|
|
|
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "rayon";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|