<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="Value that either holds a single A or B, or both."><title>EitherOrBoth in itertools - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-dd39b87e5fcfba68.css"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="itertools"data-themes=""data-resource-suffix=""data-rustdoc-version="1.80.0 (051478957 2024-07-21)"data-channel="1.80.0"data-search-js="search-d52510db62a78183.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-df360f571f6edeae.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../itertools/index.html">itertools</a><spanclass="version">0.13.0</span></h2></div><h2class="location"><ahref="#">EitherOrBoth</a></h2><divclass="sidebar-elems"><section><h3><ahref="#variants">Variants</a></h3><ulclass="block variant"><li><ahref="#variant.Both">Both</a></li><li><ahref="#variant.Left">Left</a></li><li><ahref="#variant.Right">Right</a></li></ul><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.as_deref">as_deref</a></li><li><ahref="#method.as_deref_mut">as_deref_mut</a></li><li><ahref="#method.as_mut">as_mut</a></li><li><ahref="#method.as_ref">as_ref</a></li><li><ahref="#method.both">both</a></li><li><ahref="#method.flip">flip</a></li><li><ahref="#method.has_left">has_left</a></li><li><ahref="#method.has_right">has_right</a></li><li><ahref="#method.insert_both">insert_both</a></li><li><ahref="#method.insert_left">insert_left</a></li><li><ahref="#method.insert_right">insert_right</a></li><li><ahref="#method.into_left">into_left</a></li><li><ahref="#method.into_right">into_right</a></li><li><ahref="#method.is_both">is_both</a></li><li><ahref="#method.is_left">is_left</a></li><li><ahref="#method.is_right">is_right</a></li><li><ahref="#method.just_left">just_left</a></li><li><ahref="#method.just_right">just_right</a></li><li><ahref="#method.left">left</a></li><li><ahref="#method.left_and_right">left_and_right</a></li><li><ahref="#method.left_and_then">left_and_then</a></li><li><ahref="#method.left_or_insert">left_or_insert</a></li><li><ahref="#method.left_or_insert_with">left_or_insert_with</a></li><li><ahref="#method.map_any">map_any</a></li><li><ahref="#method.map_left">map_left</a></li><li><ahref="#method.map_right">map_right</a></li><li><ahref="#method.or">or</a></li><li><ahref="#method.or_default">or_default</a></li><li><ahref="#method.or_else">or_else</a></li><li><ahref="#method.reduce">reduce</a></li><li><ahref="#method.right">right</a></li><li><ahref="#method.right_and_then">right_and_then</a></li><li><ahref="#method.right_or_insert"
}</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Value that either holds a single A or B, or both.</p>
</div></details><h2id="variants"class="variants section-header">Variants<ahref="#variants"class="anchor">§</a></h2><divclass="variants"><sectionid="variant.Both"class="variant"><ahref="#variant.Both"class="anchor">§</a><h3class="code-header">Both(A, B)</h3></section><divclass="docblock"><p>Both values are present.</p>
</div><sectionid="variant.Left"class="variant"><ahref="#variant.Left"class="anchor">§</a><h3class="code-header">Left(A)</h3></section><divclass="docblock"><p>Only the left value of type <code>A</code> is present.</p>
</div><sectionid="variant.Right"class="variant"><ahref="#variant.Right"class="anchor">§</a><h3class="code-header">Right(B)</h3></section><divclass="docblock"><p>Only the right value of type <code>B</code> is present.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.left"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#47-52">source</a><h4class="code-header">pub fn <ahref="#method.left"class="fn">left</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><A></h4></section></summary><divclass="docblock"><p>If <code>Left</code>, or <code>Both</code>, return <code>Some</code> with the left value. Otherwise, return <code>None</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.right"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#55-60">source</a><h4class="code-header">pub fn <ahref="#method.right"class="fn">right</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><B></h4></section></summary><divclass="docblock"><p>If <code>Right</code>, or <code>Both</code>, return <code>Some</code> with the right value. Otherwise, return <code>None</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.left_and_right"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#66-68">source</a><h4class="code-header">pub fn <ahref="#method.left_and_right"class="fn">left_and_right</a>(self) -> (<aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><A>, <aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><B>)</h4></section></summary><divclass="docblock"><p>Return tuple of options corresponding to the left and right value respectively</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.just_left"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#88-93">source</a><h4class="code-header">pub fn <ahref="#method.just_left"class="fn">just_left</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><A></h4></section></summary><divclass="docblock"><p>If <code>Left</code>, return <code>Some</code> with the left value. If <code>Right</code> or <code>Both</code>, return <code>None</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.just_right"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#113-118">source</a><h4class="code-header">pub fn <ahref="#method.just_right"class="fn">just_right</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><B></h4></section></summary><divclass="docblock"><p>If <code>Right</code>, return <code>Some</code> with the right value. If <code>Left</code> or <code>Both</code>, return <code>None</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.both"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#121-126">source</a><h4class="code-header">pub fn <ahref="#method.both"class="fn">both</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a>></h4></section></summary><divclass="docblock"><p>If <code>Both</code>, return <code>Some</code> containing the left and right values. Otherwise, return <code>None</code>.</p>
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><A>,</div></h4></section></summary><divclass="docblock"><p>If <code>Left</code> or <code>Both</code>, return the left value. Otherwise, convert the right value and return it.</p>
A: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><B>,</div></h4></section></summary><divclass="docblock"><p>If <code>Right</code> or <code>Both</code>, return the right value. Otherwise, convert the left value and return it.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ref"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#151-157">source</a><h4class="code-header">pub fn <ahref="#method.as_ref"class="fn">as_ref</a>(&self) -><aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&A</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&B</a>></h4></section></summary><divclass="docblock"><p>Converts from <code>&EitherOrBoth<A, B></code> to <code>EitherOrBoth<&A, &B></code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_mut"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#160-166">source</a><h4class="code-header">pub fn <ahref="#method.as_mut"class="fn">as_mut</a>(&mut self) -><aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut A</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut B</a>></h4></section></summary><divclass="docblock"><p>Converts from <code>&mut EitherOrBoth<A, B></code> to <code>EitherOrBoth<&mut A, &mut B></code>.</p>
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/deref/trait.Deref.html"title="trait core::ops::deref::Deref">Deref</a>,</div></h4></section></summary><divclass="docblock"><p>Converts from <code>&EitherOrBoth<A, B></code> to <code>EitherOrBoth<&_, &_></code> using the <ahref="https://doc.rust-lang.org/1.80.0/core/ops/deref/trait.Deref.html"title="trait core::ops::deref::Deref"><code>Deref</code></a> trait.</p>
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/deref/trait.DerefMut.html"title="trait core::ops::deref::DerefMut">DerefMut</a>,</div></h4></section></summary><divclass="docblock"><p>Converts from <code>&mut EitherOrBoth<A, B></code> to <code>EitherOrBoth<&mut _, &mut _></code> using the <ahref="https://doc.rust-lang.org/1.80.0/core/ops/deref/trait.DerefMut.html"title="trait core::ops::deref::DerefMut"><code>DerefMut</code></a> trait.</p>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(A) -> M,</div></h4></section></summary><divclass="docblock"><p>Apply the function <code>f</code> on the value <code>a</code> in <code>Left(a)</code> or <code>Both(a, b)</code> variants. If it is
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(B) -> M,</div></h4></section></summary><divclass="docblock"><p>Apply the function <code>f</code> on the value <code>b</code> in <code>Right(b)</code> or <code>Both(a, b)</code> variants.
G: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(B) -> R,</div></h4></section></summary><divclass="docblock"><p>Apply the functions <code>f</code> and <code>g</code> on the value <code>a</code> and <code>b</code> respectively;
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(A) -><aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><L, B>,</div></h4></section></summary><divclass="docblock"><p>Apply the function <code>f</code> on the value <code>a</code> in <code>Left(a)</code> or <code>Both(a, _)</code> variants if it is
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(B) -><aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><A, R>,</div></h4></section></summary><divclass="docblock"><p>Apply the function <code>f</code> on the value <code>b</code>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.or"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#287-293">source</a><h4class="code-header">pub fn <ahref="#method.or"class="fn">or</a>(self, l: A, r: B) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a></h4></section></summary><divclass="docblock"><p>Returns a tuple consisting of the <code>l</code> and <code>r</code> in <code>Both(l, r)</code>, if present.
Otherwise, returns the wrapped value for the present element, and the supplied
value for the other. The first (<code>l</code>) argument is used for a missing <code>Left</code>
value. The second (<code>r</code>) argument is used for a missing <code>Right</code> value.</p>
<p>Arguments passed to <code>or</code> are eagerly evaluated; if you are passing
the result of a function call, it is recommended to use <ahref="enum.EitherOrBoth.html#method.or_else"title="method itertools::EitherOrBoth::or_else"><code>or_else</code></a>,
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html"title="trait core::default::Default">Default</a>,</div></h4></section></summary><divclass="docblock"><p>Returns a tuple consisting of the <code>l</code> and <code>r</code> in <code>Both(l, r)</code>, if present.
Otherwise, returns the wrapped value for the present element, and the <ahref="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html#tymethod.default"title="associated function core::default::Default::default"><code>default</code></a>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.or_else"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#324-330">source</a><h4class="code-header">pub fn <ahref="#method.or_else"class="fn">or_else</a><L: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>() -> A, R: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>() -> B>(self, l: L, r: R) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.tuple.html">(A, B)</a></h4></section></summary><divclass="docblock"><p>Returns a tuple consisting of the <code>l</code> and <code>r</code> in <code>Both(l, r)</code>, if present.
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.left_or_insert"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#334-336">source</a><h4class="code-header">pub fn <ahref="#method.left_or_insert"class="fn">left_or_insert</a>(&mut self, val: A) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut A</a></h4></section></summary><divclass="docblock"><p>Returns a mutable reference to the left value. If the left value is not present,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.right_or_insert"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#340-342">source</a><h4class="code-header">pub fn <ahref="#method.right_or_insert"class="fn">right_or_insert</a>(&mut self, val: B) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut B</a></h4></section></summary><divclass="docblock"><p>Returns a mutable reference to the right value. If the right value is not present,
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>() -> A,</div></h4></section></summary><divclass="docblock"><p>If the left value is not present, replace it the value computed by the closure <code>f</code>.
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>() -> B,</div></h4></section></summary><divclass="docblock"><p>If the right value is not present, replace it the value computed by the closure <code>f</code>.
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.insert_left"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#384-409">source</a><h4class="code-header">pub fn <ahref="#method.insert_left"class="fn">insert_left</a>(&mut self, val: A) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut A</a></h4></section></summary><divclass="docblock"><p>Sets the <code>left</code> value of this instance, and returns a mutable reference to it.
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.insert_right"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#426-450">source</a><h4class="code-header">pub fn <ahref="#method.insert_right"class="fn">insert_right</a>(&mut self, val: B) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut B</a></h4></section></summary><divclass="docblock"><p>Sets the <code>right</code> value of this instance, and returns a mutable reference to it.
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.insert_both"class="method"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#454-463">source</a><h4class="code-header">pub fn <ahref="#method.insert_both"class="fn">insert_both</a>(&mut self, left: A, right: B) -> (<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut A</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut B</a>)</h4></section></summary><divclass="docblock"><p>Set <code>self</code> to <code>Both(..)</code>, containing the specified left and right values,
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(T, T) -> T,</div></h4></section></summary><divclass="docblock"><p>Return either value of left, right, or apply a function <code>f</code> to both values if both are present.
Self: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><divclass='docblock'>Feeds a slice of this type into the given <ahref="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hasher.html"title="trait core::hash::Hasher"><code>Hasher</code></a>. <ahref="https://doc.rust-lang.org/1.80.0/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PartialEq-for-EitherOrBoth%3CA,+B%3E"class="impl"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#8">source</a><ahref="#impl-PartialEq-for-EitherOrBoth%3CA,+B%3E"class="anchor">§</a><h3class="code-header">impl<A: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a>, B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a>><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a> for <aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><A, B></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq"class="method trait-impl"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#8">source</a><ahref="#method.eq"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html#tymethod.eq"class="fn">eq</a>(&self, other: &<aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><A, B>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.ne"class="method trait-impl"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="src"href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#263">source</a></span><ahref="#method.ne"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html#method.ne"class="fn">ne</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&Rhs</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><sectionid="impl-Eq-for-EitherOrBoth%3CA,+B%3E"class="impl"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#8">source</a><ahref="#impl-Eq-for-EitherOrBoth%3CA,+B%3E"class="anchor">§</a><h3class="code-header">impl<A: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html"title="trait core::cmp::Eq">Eq</a>, B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html"title="trait core::cmp::Eq">Eq</a>><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html"title="trait core::cmp::Eq">Eq</a> for <aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><A, B></h3></section><sectionid="impl-StructuralPartialEq-for-EitherOrBoth%3CA,+B%3E"class="impl"><aclass="src rightside"href="../src/itertools/either_or_both.rs.html#8">source</a><ahref="#impl-StructuralPartialEq-for-EitherOrBoth%3CA,+B%3E"class="anchor">§</a><h3class="code-header">impl<A, B><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.StructuralPartialEq.html"title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><A, B></h3></section></div><h2id="synthetic-implementations"class="section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor">§</a></h2><divid="synthetic-implementations-list"><sectionid="impl-Freeze-for-EitherOrBoth%3CA,+B%3E"class="impl"><ahref="#impl-Freeze-for-EitherOrBoth%3CA,+B%3E"class="anchor">§</a><h3class="code-header">impl<A, B><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Freeze.html"title="trait core::marker::Freeze">Freeze</a> for <aclass="enum"href="enum.EitherOrBoth.html"title="enum itertools::EitherOrBoth">EitherOrBoth</a><A, B><divclass="where">where
<code><ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-IntoEither-for-T"class="impl"><aclass="src rightside"href="../src/either/into_either.rs.html#64">source</a><ahref="#impl-IntoEither-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="../either/into_either/trait.IntoEither.html"title="trait either::into_either::IntoEither">IntoEither</a> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.into_either"class="method trait-impl"><aclass="src rightside"href="../src/either/into_either.rs.html#29">source</a><ahref="#method.into_either"class="anchor">§</a><h4class="code-header">fn <ahref="../either/into_either/trait.IntoEither.html#method.into_either"class="fn">into_either</a>(self, into_left: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -><aclass="enum"href="enum.Either.html"title="enum itertools::Either">Either</a><Self, Self><ahref="#"class="tooltip"data-notable-ty="Either<Self, Self>">ⓘ</a></h4></section></summary><divclass='docblock'>Converts <code>self</code> into a <ahref="enum.Either.html#variant.Left"title="variant itertools::Either::Left"><code>Left</code></a> variant of <ahref="enum.Either.html"title="enum itertools::Either"><code>Either<Self, Self></code></a>
Converts <code>self</code> into a <ahref="enum.Either.html#variant.Right"title="variant itertools::Either::Right"><code>Right</code></a> variant of <ahref="enum.Either.html"title="enum itertools::Either"><code>Either<Self, Self></code></a>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&Self</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass='docblock'>Converts <code>self</code> into a <ahref="enum.Either.html#variant.Left"title="variant itertools::Either::Left"><code>Left</code></a> variant of <ahref="enum.Either.html"title="enum itertools::Either"><code>Either<Self, Self></code></a>
if <code>into_left(&self)</code> returns <code>true</code>.
Converts <code>self</code> into a <ahref="enum.Either.html#variant.Right"title="variant itertools::Either::Right"><code>Right</code></a> variant of <ahref="enum.Either.html"title="enum itertools::Either"><code>Either<Self, Self></code></a>
otherwise. <ahref="../either/into_either/trait.IntoEither.html#method.into_either_with">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#805-807">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#812">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#790-792">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#797">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div><scripttype="text/json"id="notable-traits-data">{"Either<Self,Self>":"<h3>Notabletraitsfor<code><aclass=\"enum\"href=\"enum.Either.html\"title=\"enumitertools::Either\">Either</a><L,R></code></h3><pre><code><divclass=\"where\">impl<L,R><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Write.html\"title=\"traitstd::io::Write\">Write</a>for<aclass=\"enum\"href=\"enum.Either.html\"title=\"enumitertools::Either\">Either</a><L,R><divclass=\"where\">where\nL:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Write.html\"title=\"traitstd::io::Write\">Write</a>,\nR:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Write.html\"title=\"traitstd::io::Write\">Write</a>,</div></div><divclass=\"where\">impl<L,R><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Read.html\"title=\"traitstd::io::Read\">Read</a>for<aclass=\"enum\"href=\"enum.Either.html\"title=\"enumitertools::Either\">Either</a><L,R><divclass=\"where\">where\nL:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Read.html\"title=\"traitstd::io::Read\">Read</a>,\nR:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Read.html\"title=\"traitstd::io::Read\">Read</a>,</div></div><divclass=\"where\">impl<L,R><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"enum\"href=\"enum.Either.html\"title=\"enumitertools::Either\">Either</a><L,R><divclass=\"where\">where\nL:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>,\nR:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a><Item=<Las<aclass=\"trait\"