LibrEDA project web page. https://libreda.codeberg.page
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

487 lines
264 KiB

<!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="The enum `Either` with variants `Left` and `Right` is a general purpose sum type with two cases."><meta name="keywords" content="rust, rustlang, rust-lang, Either"><title>Either in either - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../either/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum Either</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Left">Left</a><a href="#variant.Right">Right</a></div><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.as_mut">as_mut</a><a href="#method.as_ref">as_ref</a><a href="#method.either">either</a><a href="#method.either_with">either_with</a><a href="#method.expect_left">expect_left</a><a href="#method.expect_right">expect_right</a><a href="#method.factor_first">factor_first</a><a href="#method.factor_second">factor_second</a><a href="#method.flip">flip</a><a href="#method.into_inner">into_inner</a><a href="#method.into_iter">into_iter</a><a href="#method.is_left">is_left</a><a href="#method.is_right">is_right</a><a href="#method.left">left</a><a href="#method.left_and_then">left_and_then</a><a href="#method.left_or">left_or</a><a href="#method.left_or_default">left_or_default</a><a href="#method.left_or_else">left_or_else</a><a href="#method.map">map</a><a href="#method.map_left">map_left</a><a href="#method.map_right">map_right</a><a href="#method.right">right</a><a href="#method.right_and_then">right_and_then</a><a href="#method.right_or">right_or</a><a href="#method.right_or_default">right_or_default</a><a href="#method.right_or_else">right_or_else</a><a href="#method.unwrap_left">unwrap_left</a><a href="#method.unwrap_right">unwrap_right</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-AsMut%3C%5BTarget%5D%3E">AsMut&lt;[Target]&gt;</a><a href="#impl-AsMut%3CTarget%3E">AsMut&lt;Target&gt;</a><a href="#impl-AsMut%3Cstr%3E">AsMut&lt;str&gt;</a><a href="#impl-AsRef%3C%5BTarget%5D%3E">AsRef&lt;[Target]&gt;</a><a href="#impl-AsRef%3CTarget%3E">AsRef&lt;Target&gt;</a><a href="#impl-AsRef%3Cstr%3E">AsRef&lt;str&gt;</a><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Debug">Debug</a><a href="#impl-Deref">Deref</a><a href="#impl-DerefMut">DerefMut</a><a href="#impl-Display">Display</a><a href="#impl-DoubleEndedIterator">DoubleEndedIterator</a><a href="#impl-Eq">Eq</a><a href="#impl-ExactSizeIterator">ExactSizeIterator</a><a href="#impl-Extend%3CA%3E">Extend&lt;A&gt;</a><a href="#impl-From%3CResult%3CR%2C%20L%3E%3E">From&lt;Result&lt;R, L&gt;&gt;</a><a href="#impl-Hash">Hash</a><a href="#impl-Into%3CResult%3CR%2C%20L%3E%3E">Into&lt;Result&lt;R, L&gt;&gt;</a><a href="#impl-Iterator">Iterator</a><a href="#impl-Ord">Ord</a><a href="#impl-PartialEq%3CEither%3CL%2C%20R%3E%3E">PartialEq&lt;Either&lt;L, R&gt;&gt;</a><a href="#impl-PartialOrd%3CEither%3CL%2C%20R%3E%3E">PartialOrd&lt;Either&lt;L, R&gt;&gt;</a><a href="#impl-StructuralEq">StructuralEq</a><a href="#impl-StructuralPartialEq">StructuralPartialEq</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-IntoIterator">IntoIterator</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><h2 class="location">Other items in<br><a href="index.html">either</a></h2><div id="sidebar-vars" data-name="Either" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img src="../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img src="../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">either</a>::<wbr><a class="enum" href="#">Either</a><button id="copy-path" onclick="copy_path(this)" title="copy path"><img src="../clipboard.svg" width="19" height="18" alt="Copy item import" title="Copy item import to clipboard"></button></span><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">&#x2212;</span>]</a></span><a class="srclink" href="../src/either/lib.rs.html#51-56" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust enum">pub enum Either&lt;L, R&gt; {
Left(L),
Right(R),
}</pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><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>
<p>The <code>Either</code> type is symmetric and treats its variants the same way, without
preference.
(For representing success or error, use the regular <code>Result</code> enum instead.)</p>
</div></details><h2 id="variants" class="variants small-section-header">
Variants<a href="#variants" class="anchor"></a></h2>
<div id="variant.Left" class="variant small-section-header"><a href="#variant.Left" class="anchor field"></a><code>Left(L)</code></div><div class="docblock"><p>A value of type <code>L</code>.</p>
</div><div id="variant.Right" class="variant small-section-header"><a href="#variant.Right" class="anchor field"></a><code>Right(R)</code></div><div class="docblock"><p>A value of type <code>R</code>.</p>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</h3><a href="#impl" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#111-657" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_left" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.is_left" class="fnname">is_left</a>(&amp;self) -&gt; bool</h4><a href="#method.is_left" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#121-126" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Return true if the value is the <code>Left</code> variant.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">values</span> <span class="op">=</span> [<span class="ident">Left</span>(<span class="number">1</span>), <span class="ident">Right</span>(<span class="string">&quot;the right value&quot;</span>)];
<span class="macro">assert_eq!</span>(<span class="ident">values</span>[<span class="number">0</span>].<span class="ident">is_left</span>(), <span class="bool-val">true</span>);
<span class="macro">assert_eq!</span>(<span class="ident">values</span>[<span class="number">1</span>].<span class="ident">is_left</span>(), <span class="bool-val">false</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_right" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.is_right" class="fnname">is_right</a>(&amp;self) -&gt; bool</h4><a href="#method.is_right" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#137-139" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Return true if the value is the <code>Right</code> variant.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">values</span> <span class="op">=</span> [<span class="ident">Left</span>(<span class="number">1</span>), <span class="ident">Right</span>(<span class="string">&quot;the right value&quot;</span>)];
<span class="macro">assert_eq!</span>(<span class="ident">values</span>[<span class="number">0</span>].<span class="ident">is_right</span>(), <span class="bool-val">false</span>);
<span class="macro">assert_eq!</span>(<span class="ident">values</span>[<span class="number">1</span>].<span class="ident">is_right</span>(), <span class="bool-val">true</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.left" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.left" class="fnname">left</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;L&gt;</h4><a href="#method.left" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#152-157" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert the left side of <code>Either&lt;L, R&gt;</code> to an <code>Option&lt;L&gt;</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;some value&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">left</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;some value&quot;</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">321</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">left</span>(), <span class="prelude-val">None</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.right" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.right" class="fnname">right</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;R&gt;</h4><a href="#method.right" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#170-175" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert the right side of <code>Either&lt;L, R&gt;</code> to an <code>Option&lt;R&gt;</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;some value&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">right</span>(), <span class="prelude-val">None</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">321</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">right</span>(), <span class="prelude-val">Some</span>(<span class="number">321</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.as_ref" class="fnname">as_ref</a>(&amp;self) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;&amp;L, &amp;R&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span></h4><a href="#method.as_ref" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#188-193" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert <code>&amp;Either&lt;L, R&gt;</code> to <code>Either&lt;&amp;L, &amp;R&gt;</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;some value&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">as_ref</span>(), <span class="ident">Left</span>(<span class="kw-2">&amp;</span><span class="string">&quot;some value&quot;</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="string">&quot;some value&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">as_ref</span>(), <span class="ident">Right</span>(<span class="kw-2">&amp;</span><span class="string">&quot;some value&quot;</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_mut" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.as_mut" class="fnname">as_mut</a>(&amp;mut self) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;&amp;mut L, &amp;mut R&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span></h4><a href="#method.as_mut" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#213-218" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert <code>&amp;mut Either&lt;L, R&gt;</code> to <code>Either&lt;&amp;mut L, &amp;mut R&gt;</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">fn</span> <span class="ident">mutate_left</span>(<span class="ident">value</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="ident">u32</span><span class="op">&gt;</span>) {
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">l</span>) <span class="op">=</span> <span class="ident">value</span>.<span class="ident">as_mut</span>().<span class="ident">left</span>() {
<span class="kw-2">*</span><span class="ident">l</span> <span class="op">=</span> <span class="number">999</span>;
}
}
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">left</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">right</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">123</span>);
<span class="ident">mutate_left</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">left</span>);
<span class="ident">mutate_left</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">right</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>, <span class="ident">Left</span>(<span class="number">999</span>));
<span class="macro">assert_eq!</span>(<span class="ident">right</span>, <span class="ident">Right</span>(<span class="number">123</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.flip" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.flip" class="fnname">flip</a>(self) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;R, L&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span></h4><a href="#method.flip" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#231-236" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert <code>Either&lt;L, R&gt;</code> to <code>Either&lt;R, L&gt;</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">flip</span>(), <span class="ident">Right</span>(<span class="number">123</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="string">&quot;some value&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">flip</span>(), <span class="ident">Left</span>(<span class="string">&quot;some value&quot;</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.map_left" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.map_left" class="fnname">map_left</a>&lt;F, M&gt;(self, f: F) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;M, R&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(L) -&gt; M,&nbsp;</span></h4><a href="#method.map_left" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#250-258" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Apply the function <code>f</code> on the value in the <code>Left</code> variant if it is present rewrapping the
result in <code>Left</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">map_left</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>), <span class="ident">Left</span>(<span class="number">246</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">map_left</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>), <span class="ident">Right</span>(<span class="number">123</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.map_right" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.map_right" class="fnname">map_right</a>&lt;F, S&gt;(self, f: F) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, S&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(R) -&gt; S,&nbsp;</span></h4><a href="#method.map_right" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#272-280" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Apply the function <code>f</code> on the value in the <code>Right</code> variant if it is present rewrapping the
result in <code>Right</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">map_right</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>), <span class="ident">Left</span>(<span class="number">123</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">map_right</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>), <span class="ident">Right</span>(<span class="number">246</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.either" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.either" class="fnname">either</a>&lt;F, G, T&gt;(self, f: F, g: G) -&gt; T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(L) -&gt; T,<br>&nbsp;&nbsp;&nbsp;&nbsp;G: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(R) -&gt; T,&nbsp;</span></h4><a href="#method.either" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#298-307" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Apply one of two functions depending on contents, unifying their result. If the value is
<code>Left(L)</code> then the first function <code>f</code> is applied; if it is <code>Right(R)</code> then the second
function <code>g</code> is applied.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">fn</span> <span class="ident">square</span>(<span class="ident">n</span>: <span class="ident">u32</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">i32</span> { (<span class="ident">n</span> <span class="op">*</span> <span class="ident">n</span>) <span class="kw">as</span> <span class="ident">i32</span> }
<span class="kw">fn</span> <span class="ident">negate</span>(<span class="ident">n</span>: <span class="ident">i32</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">i32</span> { <span class="op">-</span><span class="ident">n</span> }
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="ident">i32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">either</span>(<span class="ident">square</span>, <span class="ident">negate</span>), <span class="number">16</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="ident">i32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="op">-</span><span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">either</span>(<span class="ident">square</span>, <span class="ident">negate</span>), <span class="number">4</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.either_with" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.either_with" class="fnname">either_with</a>&lt;Ctx, F, G, T&gt;(self, ctx: Ctx, f: F, g: G) -&gt; T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Ctx, L) -&gt; T,<br>&nbsp;&nbsp;&nbsp;&nbsp;G: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Ctx, R) -&gt; T,&nbsp;</span></h4><a href="#method.either_with" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#328-337" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Like <code>either</code>, but provide some context to whichever of the
functions ends up being called.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// In this example, the context is a mutable reference</span>
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
<span class="kw">let</span> <span class="ident">values</span> <span class="op">=</span> <span class="macro">vec!</span>[<span class="ident">Left</span>(<span class="number">2</span>), <span class="ident">Right</span>(<span class="number">2.7</span>)];
<span class="kw">for</span> <span class="ident">value</span> <span class="kw">in</span> <span class="ident">values</span> {
<span class="ident">value</span>.<span class="ident">either_with</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">result</span>,
<span class="op">|</span><span class="ident">ctx</span>, <span class="ident">integer</span><span class="op">|</span> <span class="ident">ctx</span>.<span class="ident">push</span>(<span class="ident">integer</span>),
<span class="op">|</span><span class="ident">ctx</span>, <span class="ident">real</span><span class="op">|</span> <span class="ident">ctx</span>.<span class="ident">push</span>(<span class="ident">f64::round</span>(<span class="ident">real</span>) <span class="kw">as</span> <span class="ident">i32</span>));
}
<span class="macro">assert_eq!</span>(<span class="ident">result</span>, <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">3</span>]);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.left_and_then" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.left_and_then" class="fnname">left_and_then</a>&lt;F, S&gt;(self, f: F) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;S, R&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(L) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;S, R&gt;,&nbsp;</span></h4><a href="#method.left_and_then" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#350-358" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Apply the function <code>f</code> on the value in the <code>Left</code> variant if it is present.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">left_and_then</span>::<span class="op">&lt;</span><span class="kw">_</span>,()<span class="op">&gt;</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">Right</span>(<span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>)), <span class="ident">Right</span>(<span class="number">246</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">left_and_then</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">Right</span>::<span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span>(<span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>)), <span class="ident">Right</span>(<span class="number">123</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.right_and_then" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.right_and_then" class="fnname">right_and_then</a>&lt;F, S&gt;(self, f: F) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, S&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(R) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, S&gt;,&nbsp;</span></h4><a href="#method.right_and_then" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#371-379" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Apply the function <code>f</code> on the value in the <code>Right</code> variant if it is present.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">right_and_then</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">Right</span>(<span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>)), <span class="ident">Left</span>(<span class="number">123</span>));
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">right_and_then</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">Right</span>(<span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>)), <span class="ident">Right</span>(<span class="number">246</span>));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into_iter" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.into_iter" class="fnname">into_iter</a>(self) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>, R::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a>&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>&gt;,&nbsp;</span></h4><a href="#method.into_iter" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#391-400" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert the inner value to an iterator.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u32</span><span class="op">&gt;</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<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> <span class="kw-2">mut</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u32</span><span class="op">&gt;</span>, <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="macro">vec!</span>[]);
<span class="ident">right</span>.<span class="ident">extend</span>(<span class="ident">left</span>.<span class="ident">into_iter</span>());
<span class="macro">assert_eq!</span>(<span class="ident">right</span>, <span class="ident">Right</span>(<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>]));</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.left_or" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.left_or" class="fnname">left_or</a>(self, other: L) -&gt; L</h4><a href="#method.left_or" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#420-425" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Return left value or given value</p>
<p>Arguments passed to <code>left_or</code> are eagerly evaluated; if you are passing
the result of a function call, it is recommended to use <a href="#method.left_or_else"><code>left_or_else</code></a>,
which is lazily evaluated.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;left&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">left_or</span>(<span class="string">&quot;foo&quot;</span>), <span class="string">&quot;left&quot;</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="string">&quot;right&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">left_or</span>(<span class="string">&quot;left&quot;</span>), <span class="string">&quot;left&quot;</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.left_or_default" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.left_or_default" class="fnname">left_or_default</a>(self) -&gt; L <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,&nbsp;</span></h4><a href="#method.left_or_default" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#439-447" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Return left or a default</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;left&quot;</span>.<span class="ident">to_string</span>());
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">left_or_default</span>(), <span class="string">&quot;left&quot;</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">42</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">left_or_default</span>(), <span class="ident">String::default</span>());</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.left_or_else" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.left_or_else" class="fnname">left_or_else</a>&lt;F&gt;(self, f: F) -&gt; L <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(R) -&gt; L,&nbsp;</span></h4><a href="#method.left_or_else" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#461-469" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Returns left value or computes it from a closure</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;3&quot;</span>.<span class="ident">to_string</span>());
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">left_or_else</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> <span class="macro">unreachable!</span>()), <span class="string">&quot;3&quot;</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">left_or_else</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span>.<span class="ident">to_string</span>()), <span class="string">&quot;3&quot;</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.right_or" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.right_or" class="fnname">right_or</a>(self, other: R) -&gt; R</h4><a href="#method.right_or" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#489-494" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Return right value or given value</p>
<p>Arguments passed to <code>right_or</code> are eagerly evaluated; if you are passing
the result of a function call, it is recommended to use <a href="#method.right_or_else"><code>right_or_else</code></a>,
which is lazily evaluated.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="string">&quot;right&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">right_or</span>(<span class="string">&quot;foo&quot;</span>), <span class="string">&quot;right&quot;</span>);
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;left&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">right_or</span>(<span class="string">&quot;right&quot;</span>), <span class="string">&quot;right&quot;</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.right_or_default" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.right_or_default" class="fnname">right_or_default</a>(self) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,&nbsp;</span></h4><a href="#method.right_or_default" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#508-516" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Return right or a default</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;left&quot;</span>.<span class="ident">to_string</span>());
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">right_or_default</span>(), <span class="ident">u32::default</span>());
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">42</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">right_or_default</span>(), <span class="number">42</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.right_or_else" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.right_or_else" class="fnname">right_or_else</a>&lt;F&gt;(self, f: F) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(L) -&gt; R,&nbsp;</span></h4><a href="#method.right_or_else" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#530-538" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Returns right value or computes it from a closure</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="string">&quot;3&quot;</span>.<span class="ident">to_string</span>());
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">right_or_else</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span>.<span class="ident">parse</span>().<span class="ident">unwrap</span>()), <span class="number">3</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">right_or_else</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> <span class="macro">unreachable!</span>()), <span class="number">3</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.unwrap_left" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.unwrap_left" class="fnname">unwrap_left</a>(self) -&gt; L <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,&nbsp;</span></h4><a href="#method.unwrap_left" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#559-569" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Returns the left value</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">unwrap_left</span>(), <span class="number">3</span>);</pre></div>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>When <code>Either</code> is a <code>Right</code> value</p>
<div class='information'><div class='tooltip should_panic'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered should_panic">
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">3</span>);
<span class="ident">right</span>.<span class="ident">unwrap_left</span>();</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.unwrap_right" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.unwrap_right" class="fnname">unwrap_right</a>(self) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,&nbsp;</span></h4><a href="#method.unwrap_right" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#590-598" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Returns the right value</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">unwrap_right</span>(), <span class="number">3</span>);</pre></div>
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
<p>When <code>Either</code> is a <code>Left</code> value</p>
<div class='information'><div class='tooltip should_panic'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered should_panic">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">3</span>);
<span class="ident">left</span>.<span class="ident">unwrap_right</span>();</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.expect_left" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.expect_left" class="fnname">expect_left</a>(self, msg: &amp;str) -&gt; L <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,&nbsp;</span></h4><a href="#method.expect_left" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#619-627" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Returns the left value</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">expect_left</span>(<span class="string">&quot;value was Right&quot;</span>), <span class="number">3</span>);</pre></div>
<h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
<p>When <code>Either</code> is a <code>Right</code> value</p>
<div class='information'><div class='tooltip should_panic'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered should_panic">
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">3</span>);
<span class="ident">right</span>.<span class="ident">expect_left</span>(<span class="string">&quot;value was Right&quot;</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.expect_right" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.expect_right" class="fnname">expect_right</a>(self, msg: &amp;str) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,&nbsp;</span></h4><a href="#method.expect_right" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#648-656" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Returns the right value</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">expect_right</span>(<span class="string">&quot;value was Left&quot;</span>), <span class="number">3</span>);</pre></div>
<h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
<p>When <code>Either</code> is a <code>Left</code> value</p>
<div class='information'><div class='tooltip should_panic'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered should_panic">
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, ()<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">3</span>);
<span class="ident">left</span>.<span class="ident">expect_right</span>(<span class="string">&quot;value was Right&quot;</span>);</pre></div>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-1" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;T, L, R&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;(T, L), (T, R)&gt;</h3><a href="#impl-1" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#659-678" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.factor_first" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.factor_first" class="fnname">factor_first</a>(self) -&gt; (T, <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;)</h4><a href="#method.factor_first" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#672-677" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Factor out a homogeneous type from an either of pairs.</p>
<p>Here, the homogeneous type is the first element of the pairs.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, (<span class="ident">u32</span>, <span class="ident">String</span>)<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>((<span class="number">123</span>, <span class="macro">vec!</span>[<span class="number">0</span>]));
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">factor_first</span>().<span class="number">0</span>, <span class="number">123</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(<span class="ident">u32</span>, <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u8</span><span class="op">&gt;</span>), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>((<span class="number">123</span>, <span class="ident">String::new</span>()));
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">factor_first</span>().<span class="number">0</span>, <span class="number">123</span>);</pre></div>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-2" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;T, L, R&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;(L, T), (R, T)&gt;</h3><a href="#impl-2" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#680-699" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.factor_second" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.factor_second" class="fnname">factor_second</a>(self) -&gt; (<a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;, T)</h4><a href="#method.factor_second" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#693-698" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Factor out a homogeneous type from an either of pairs.</p>
<p>Here, the homogeneous type is the second element of the pairs.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, (<span class="ident">String</span>, <span class="ident">u32</span>)<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>((<span class="macro">vec!</span>[<span class="number">0</span>], <span class="number">123</span>));
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">factor_second</span>().<span class="number">1</span>, <span class="number">123</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span>(<span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u8</span><span class="op">&gt;</span>, <span class="ident">u32</span>), <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>((<span class="ident">String::new</span>(), <span class="number">123</span>));
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">factor_second</span>().<span class="number">1</span>, <span class="number">123</span>);</pre></div>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-3" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;T&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;T, T&gt;</h3><a href="#impl-3" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#701-737" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into_inner" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.into_inner" class="fnname">into_inner</a>(self) -&gt; T</h4><a href="#method.into_inner" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#713-715" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Extract the value of an either over two equivalent types.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">left</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">u32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Left</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">left</span>.<span class="ident">into_inner</span>(), <span class="number">123</span>);
<span class="kw">let</span> <span class="ident">right</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="ident">u32</span>, <span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">123</span>);
<span class="macro">assert_eq!</span>(<span class="ident">right</span>.<span class="ident">into_inner</span>(), <span class="number">123</span>);</pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.map" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.map" class="fnname">map</a>&lt;F, M&gt;(self, f: F) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;M, M&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(T) -&gt; M,&nbsp;</span></h4><a href="#method.map" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#728-736" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Map <code>f</code> over the contained value and return the result in the
corresponding variant.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">either</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">value</span>: <span class="ident">Either</span><span class="op">&lt;</span><span class="kw">_</span>, <span class="ident">i32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Right</span>(<span class="number">42</span>);
<span class="kw">let</span> <span class="ident">other</span> <span class="op">=</span> <span class="ident">value</span>.<span class="ident">map</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">*</span> <span class="number">2</span>);
<span class="macro">assert_eq!</span>(<span class="ident">other</span>, <span class="ident">Right</span>(<span class="number">84</span>));</pre></div>
</div></details></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AsMut%3C%5BTarget%5D%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R, Target&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[Target]&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[Target]&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[Target]&gt;,&nbsp;</span></h3><a href="#impl-AsMut%3C%5BTarget%5D%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#960-968" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_mut-3" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html#tymethod.as_mut" class="fnname">as_mut</a>(&amp;mut self) -&gt; &amp;mut [Target]</h4><a href="#method.as_mut-3" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#965-967" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AsMut%3CTarget%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R, Target&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;Target&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;Target&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;Target&gt;,&nbsp;</span></h3><a href="#impl-AsMut%3CTarget%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#950-958" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_mut-2" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html#tymethod.as_mut" class="fnname">as_mut</a>(&amp;mut self) -&gt; &amp;mut Target</h4><a href="#method.as_mut-2" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#955-957" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AsMut%3Cstr%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;str&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;str&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;str&gt;,&nbsp;</span></h3><a href="#impl-AsMut%3Cstr%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#923" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_mut-1" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsMut.html#tymethod.as_mut" class="fnname">as_mut</a>(&amp;mut self) -&gt; &amp;mut str</h4><a href="#method.as_mut-1" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#923" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AsRef%3C%5BTarget%5D%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R, Target&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[Target]&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[Target]&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[Target]&gt;,&nbsp;</span></h3><a href="#impl-AsRef%3C%5BTarget%5D%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#940-948" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref-3" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&amp;self) -&gt; &amp;[Target]</h4><a href="#method.as_ref-3" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#945-947" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AsRef%3CTarget%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R, Target&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;Target&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;Target&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;Target&gt;,&nbsp;</span></h3><a href="#impl-AsRef%3CTarget%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#891-899" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref-1" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&amp;self) -&gt; &amp;Target</h4><a href="#method.as_ref-1" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#896-898" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AsRef%3Cstr%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;str&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;str&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;str&gt;,&nbsp;</span></h3><a href="#impl-AsRef%3Cstr%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#923" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref-2" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&amp;self) -&gt; &amp;str</h4><a href="#method.as_ref-2" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#923" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Clone" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</h3><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#50" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.clone" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><div class="notable">Notable traits for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</div><code class="content"><span class="where fmt-newline">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>;</span></code></span></div></span></span></h4><a href="#method.clone" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#50" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.clone_from" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: &amp;Self)</h4><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/clone.rs.html#130" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.54.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Debug" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>, R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</h3><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#50" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.54.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.54.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4><a href="#method.fmt" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#50" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Deref" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>&gt;,&nbsp;</span></h3><a href="#impl-Deref" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#970-980" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Target" class="type trait-impl has-srclink"><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#associatedtype.Target" class="type">Target</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4><a href="#associatedtype.Target" class="anchor"></a></div></summary><div class='docblock'><p>The resulting type after dereferencing.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.deref" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#tymethod.deref" class="fnname">deref</a>(&amp;self) -&gt; &amp;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4><a href="#method.deref" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#977-979" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Dereferences the value.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-DerefMut" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>&lt;Target = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>&gt;,&nbsp;</span></h3><a href="#impl-DerefMut" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#982-990" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.deref_mut" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut" class="fnname">deref_mut</a>(&amp;mut self) -&gt; &amp;mut Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4><a href="#method.deref_mut" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#987-989" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Mutably dereferences the value.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Display" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,&nbsp;</span></h3><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#1011-1019" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt-1" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.54.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.54.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4><a href="#method.fmt-1" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#1016-1018" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.54.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-DoubleEndedIterator" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator">DoubleEndedIterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator">DoubleEndedIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html" title="trait core::iter::traits::double_ended::DoubleEndedIterator">DoubleEndedIterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></h3><a href="#impl-DoubleEndedIterator" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#822-830" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.next_back" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#tymethod.next_back" class="fnname">next_back</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</h4><a href="#method.next_back" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#827-829" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Removes and returns an element from the end of the iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#tymethod.next_back">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.advance_back_by" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.advance_back_by" class="fnname">advance_back_by</a>(&amp;mut self, n: usize) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(), usize&gt;</h4><a href="#method.advance_back_by" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/double_ended.rs.html#130" title="goto source code">[src]</a></div></summary><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>iter_advance_by</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock'><p>Advances the iterator from the back by <code>n</code> elements. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.advance_back_by">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.nth_back" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.nth_back" class="fnname">nth_back</a>(&amp;mut self, n: usize) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</h4><span class="since" title="Stable since Rust version 1.37.0">1.37.0</span><a href="#method.nth_back" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/double_ended.rs.html#180" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Returns the <code>n</code>th element from the end of the iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.nth_back">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_rfold" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.try_rfold" class="fnname">try_rfold</a>&lt;B, F, R&gt;(&amp;mut self, init: B, f: F) -&gt; R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/try_trait/trait.Try.html" title="trait core::ops::try_trait::Try">Try</a>&lt;Output = B&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; R,&nbsp;</span></h4><span class="since" title="Stable since Rust version 1.27.0">1.27.0</span><a href="#method.try_rfold" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/double_ended.rs.html#217-221" title="goto source code">[src]</a></div></summary><div class='docblock'><p>This is the reverse version of <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.try_fold" title="Iterator::try_fold()"><code>Iterator::try_fold()</code></a>: it takes
elements starting from the back of the iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.try_rfold">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.rfold" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.rfold" class="fnname">rfold</a>&lt;B, F&gt;(self, init: B, f: F) -&gt; B <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(B, Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; B,&nbsp;</span></h4><span class="since" title="Stable since Rust version 1.27.0">1.27.0</span><a href="#method.rfold" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/double_ended.rs.html#281-284" title="goto source code">[src]</a></div></summary><div class='docblock'><p>An iterator method that reduces the iterator’s elements to a single,
final value, starting from the back. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.rfold">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.rfind" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.rfind" class="fnname">rfind</a>&lt;P&gt;(&amp;mut self, predicate: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; bool,&nbsp;</span></h4><span class="since" title="Stable since Rust version 1.27.0">1.27.0</span><a href="#method.rfind" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/double_ended.rs.html#336-339" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Searches for an element of an iterator from the back that satisfies a predicate. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/double_ended/trait.DoubleEndedIterator.html#method.rfind">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-ExactSizeIterator" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator">ExactSizeIterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator">ExactSizeIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html" title="trait core::iter::traits::exact_size::ExactSizeIterator">ExactSizeIterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></h3><a href="#impl-ExactSizeIterator" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#832-837" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.len" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html#method.len" class="fnname">len</a>(&amp;self) -&gt; usize</h4><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.len" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/exact_size.rs.html#103" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Returns the exact length of the iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html#method.len">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_empty" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html#method.is_empty" class="fnname">is_empty</a>(&amp;self) -&gt; bool</h4><a href="#method.is_empty" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/exact_size.rs.html#135" title="goto source code">[src]</a></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>exact_size_is_empty</code>)</div></div><div class='docblock'><p>Returns <code>true</code> if the iterator is empty. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/exact_size/trait.ExactSizeIterator.html#method.is_empty">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Extend%3CA%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt;,&nbsp;</span></h3><a href="#impl-Extend%3CA%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#759-770" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.extend" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fnname">extend</a>&lt;T&gt;(&amp;mut self, iter: T) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = A&gt;,&nbsp;</span></h4><a href="#method.extend" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#764-769" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.extend_one" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fnname">extend_one</a>(&amp;mut self, item: A)</h4><a href="#method.extend_one" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/collect.rs.html#341" title="goto source code">[src]</a></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>extend_one</code>)</div></div><div class='docblock'><p>Extends a collection with exactly one element.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.extend_reserve" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fnname">extend_reserve</a>(&amp;mut self, additional: usize)</h4><a href="#method.extend_reserve" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/collect.rs.html#349" title="goto source code">[src]</a></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>extend_one</code>)</div></div><div class='docblock'><p>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-From%3CResult%3CR%2C%20L%3E%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.54.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, L&gt;&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</h3><a href="#impl-From%3CResult%3CR%2C%20L%3E%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#740-747" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert from <code>Result</code> to <code>Either</code> with <code>Ok =&gt; Right</code> and <code>Err =&gt; Left</code>.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(r: <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, L&gt;) -&gt; Self</h4><a href="#method.from" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#741-746" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Hash" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, R:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</h3><a href="#impl-Hash" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#50" title="goto source code">[src]</a></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.hash" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html#tymethod.hash" class="fnname">hash</a>&lt;__H:&nbsp;<a class="trait" href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>&gt;(&amp;self, state: &amp;mut __H)</h4><a href="#method.hash" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#50" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Feeds this value into the given <a href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.hash_slice" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html#method.hash_slice" class="fnname">hash_slice</a>&lt;H&gt;(data: &amp;[Self], state: &amp;mut H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,&nbsp;</span></h4><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span><a href="#method.hash_slice" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/hash/mod.rs.html#211-213" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.54.0/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Into%3CResult%3CR%2C%20L%3E%3E" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.54.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, L&gt;&gt; for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt;</h3><a href="#impl-Into%3CResult%3CR%2C%20L%3E%3E" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#750-757" title="goto source code">[src]</a></div></summary><div class="docblock"><p>Convert from <code>Either</code> to <code>Result</code> with <code>Right =&gt; Ok</code> and <code>Left =&gt; Err</code>.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;R, L&gt;</h4><a href="#method.into" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#751-756" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-Iterator" class="impl has-srclink"><h3 class="code-header in-band">impl&lt;L, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="enum" href="enum.Either.html" title="enum either::Either">Either</a>&lt;L, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;L: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></h3><a href="#impl-Iterator" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#773-820" title="goto source code">[src]</a></div></summary><div class="docblock"><p><code>Either&lt;L, R&gt;</code> is an iterator if both <code>L</code> and <code>R</code> are iterators.</p>
</div><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Item" class="type trait-impl has-srclink"><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = L::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a></h4><a href="#associatedtype.Item" class="anchor"></a></div></summary><div class='docblock'><p>The type of the elements being iterated over.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.next" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#tymethod.next" class="fnname">next</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</h4><a href="#method.next" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#780-782" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Advances the iterator and returns the next value. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#tymethod.next">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.size_hint" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.size_hint" class="fnname">size_hint</a>(&amp;self) -&gt; (usize, <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;usize&gt;)</h4><a href="#method.size_hint" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#784-786" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Returns the bounds on the remaining length of the iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.size_hint">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fold" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.fold" class="fnname">fold</a>&lt;Acc, G&gt;(self, init: Acc, f: G) -&gt; Acc <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;G: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Acc, Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; Acc,&nbsp;</span></h4><a href="#method.fold" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#788-793" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Folds every element into an accumulator by applying an operation,
returning the final result. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.fold">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.count" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.count" class="fnname">count</a>(self) -&gt; usize</h4><a href="#method.count" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#795-797" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Consumes the iterator, counting the number of iterations and returning it. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.count">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.last" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.last" class="fnname">last</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</h4><a href="#method.last" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#799-801" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Consumes the iterator, returning the last element. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.last">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.nth" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.nth" class="fnname">nth</a>(&amp;mut self, n: usize) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;</h4><a href="#method.nth" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#803-805" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Returns the <code>n</code>th element of the iterator. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.nth">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.collect" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.collect" class="fnname">collect</a>&lt;B&gt;(self) -&gt; B <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a>&lt;Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>&gt;,&nbsp;</span></h4><a href="#method.collect" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#807-812" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Transforms an iterator into a collection. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.collect">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.all" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.all" class="fnname">all</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; bool <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/1.54.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>) -&gt; bool,&nbsp;</span></h4><a href="#method.all" class="anchor"></a><a class="srclink" href="../src/either/lib.rs.html#814-819" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Tests if every element of the iterator matches a predicate. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.all">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.advance_by" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.advance_by" class="fnname">advance_by</a>(&amp;mut self, n: usize) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.54.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(), usize&gt;</h4><a href="#method.advance_by" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/iterator.rs.html#276" title="goto source code">[src]</a></div></summary><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>iter_advance_by</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock'><p>Advances the iterator by <code>n</code> elements. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.advance_by">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.step_by" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.step_by" class="fnname">step_by</a>(self, step: usize) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.54.0/core/iter/adapters/step_by/struct.StepBy.html" title="struct core::iter::adapters::step_by::StepBy">StepBy</a>&lt;Self&gt;</h4><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span><a href="#method.step_by" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/1.54.0/src/core/iter/traits/iterator.rs.html#375-377" title="goto source code">[src]</a></div></summary><div class='docblock'><p>Creates an iterator starting at the same point, but stepping by
the given amount at each iteration. <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.step_by">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.chain" class="method trait-impl has-srclink"><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.54.0/core/iter/traits/iterator/trait.Iterator.html#method.chain" class="fnname">chain</a>