blob: 3b56b293691d82d78cc1f7f1670a94fa16adcd64 [file] [log] [blame]
<!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="`IntoParallelRefIterator` implements the conversion to a `ParallelIterator`, providing shared references to the data."><meta name="keywords" content="rust, rustlang, rust-lang, IntoParallelRefIterator"><title>IntoParallelRefIterator in rayon::iter - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.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">&#9776;</button><a class="sidebar-logo" href="../../rayon/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../rayon/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">IntoParallelRefIterator</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Item">Item</a></li><li><a href="#associatedtype.Iter">Iter</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.par_iter">par_iter</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In rayon::iter</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="../index.html">rayon</a>::<wbr><a href="index.html">iter</a>::<wbr><a class="trait" href="#">IntoParallelRefIterator</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/rayon/iter/mod.rs.html#259-283">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait IntoParallelRefIterator&lt;'data&gt; {
type <a href="#associatedtype.Iter" class="associatedtype">Iter</a>: <a class="trait" href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator">ParallelIterator</a>&lt;Item = Self::<a class="associatedtype" href="trait.IntoParallelRefIterator.html#associatedtype.Item" title="type rayon::iter::IntoParallelRefIterator::Item">Item</a>&gt;;
type <a href="#associatedtype.Item" class="associatedtype">Item</a>: Send + 'data;
fn <a href="#tymethod.par_iter" class="fnname">par_iter</a>(&amp;'data self) -&gt; Self::<a class="associatedtype" href="trait.IntoParallelRefIterator.html#associatedtype.Iter" title="type rayon::iter::IntoParallelRefIterator::Iter">Iter</a>;
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><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>
<p>This is a parallel version of the <code>iter()</code> method
defined by various collections.</p>
<p>This trait is automatically implemented
<code>for I where &amp;I: IntoParallelIterator</code>. In most cases, users
will want to implement <a href="trait.IntoParallelIterator.html"><code>IntoParallelIterator</code></a> rather than implement
this trait directly.</p>
</div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="associatedtype.Iter" class="method has-srclink"><a class="srclink rightside" href="../../src/rayon/iter/mod.rs.html#261">source</a><h4 class="code-header">type <a href="#associatedtype.Iter" class="associatedtype">Iter</a>: <a class="trait" href="trait.ParallelIterator.html" title="trait rayon::iter::ParallelIterator">ParallelIterator</a>&lt;Item = Self::<a class="associatedtype" href="trait.IntoParallelRefIterator.html#associatedtype.Item" title="type rayon::iter::IntoParallelRefIterator::Item">Item</a>&gt;</h4></section></summary><div class="docblock"><p>The type of the parallel iterator that will be returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="associatedtype.Item" class="method has-srclink"><a class="srclink rightside" href="../../src/rayon/iter/mod.rs.html#265">source</a><h4 class="code-header">type <a href="#associatedtype.Item" class="associatedtype">Item</a>: Send + 'data</h4></section></summary><div class="docblock"><p>The type of item that the parallel iterator will produce.
This will typically be an <code>&amp;'data T</code> reference type.</p>
</div></details></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.par_iter" class="method has-srclink"><a class="srclink rightside" href="../../src/rayon/iter/mod.rs.html#282">source</a><h4 class="code-header">fn <a href="#tymethod.par_iter" class="fnname">par_iter</a>(&amp;'data self) -&gt; Self::<a class="associatedtype" href="trait.IntoParallelRefIterator.html#associatedtype.Iter" title="type rayon::iter::IntoParallelRefIterator::Iter">Iter</a></h4></section></summary><div class="docblock"><p>Converts <code>self</code> into a parallel iterator.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<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">let </span>v: Vec&lt;<span class="kw">_</span>&gt; = (<span class="number">0</span>..<span class="number">100</span>).collect();
<span class="macro">assert_eq!</span>(v.par_iter().sum::&lt;i32&gt;(), <span class="number">100 </span>* <span class="number">99 </span>/ <span class="number">2</span>);
<span class="comment">// `v.par_iter()` is shorthand for `(&amp;v).into_par_iter()`,
// producing the exact same references.
</span><span class="macro">assert!</span>(v.par_iter().zip(<span class="kw-2">&amp;</span>v)
.all(|(a, b)| std::ptr::eq(a, b)));</code></pre></div>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-IntoParallelRefIterator%3C%27data%3E-for-I" class="impl has-srclink"><a class="srclink rightside" href="../../src/rayon/iter/mod.rs.html#285-295">source</a><a href="#impl-IntoParallelRefIterator%3C%27data%3E-for-I" class="anchor"></a><h3 class="code-header">impl&lt;'data, I:&nbsp;'data + ?Sized&gt; <a class="trait" href="trait.IntoParallelRefIterator.html" title="trait rayon::iter::IntoParallelRefIterator">IntoParallelRefIterator</a>&lt;'data&gt; for I<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;'data I: <a class="trait" href="trait.IntoParallelIterator.html" title="trait rayon::iter::IntoParallelIterator">IntoParallelIterator</a>,</span></h3></section></summary><div class="impl-items"><section id="associatedtype.Iter-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Iter-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Iter" class="associatedtype">Iter</a> = &lt;&amp;'data I as <a class="trait" href="trait.IntoParallelIterator.html" title="trait rayon::iter::IntoParallelIterator">IntoParallelIterator</a>&gt;::<a class="associatedtype" href="trait.IntoParallelIterator.html#associatedtype.Iter" title="type rayon::iter::IntoParallelIterator::Iter">Iter</a></h4></section><section id="associatedtype.Item-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Item-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Item" class="associatedtype">Item</a> = &lt;&amp;'data I as <a class="trait" href="trait.IntoParallelIterator.html" title="trait rayon::iter::IntoParallelIterator">IntoParallelIterator</a>&gt;::<a class="associatedtype" href="trait.IntoParallelIterator.html#associatedtype.Item" title="type rayon::iter::IntoParallelIterator::Item">Item</a></h4></section></div></details></div><script src="../../implementors/rayon/iter/trait.IntoParallelRefIterator.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="rayon" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>