pub struct PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
S: 'a,
A: 'a,{ /* private fields */ }Expand description
Implementations§
Source§impl<'a, PointerBrand, S: 'a, A: 'a> PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S: 'a, A: 'a> PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Sourcepub fn new(
preview: impl 'a + Fn(S) -> Result<A, S>,
review: impl 'a + Fn(A) -> S,
) -> Self
pub fn new( preview: impl 'a + Fn(S) -> Result<A, S>, review: impl 'a + Fn(A) -> S, ) -> Self
Create a new monomorphic prism from preview and review functions without requiring S: Clone.
This uses a Result<A, S> which is closer to the true Either encoding.
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => (S -> Result A S, A -> S) -> PrismPrime PointerBrand S A
§Parameters
preview: The preview function.review: The review function.
§Returns
A new instance of the type.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::PrismPrime,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::new(|r: Result<i32, String>| r.map_err(|e| Err(e)), |x| Ok(x));
assert_eq!(ok_prism.preview(Ok(42)), Some(42));Sourcepub fn from_option(
preview: impl 'a + Fn(S) -> Option<A>,
review: impl 'a + Fn(A) -> S,
) -> Selfwhere
S: Clone,
pub fn from_option(
preview: impl 'a + Fn(S) -> Option<A>,
review: impl 'a + Fn(A) -> S,
) -> Selfwhere
S: Clone,
Create a new monomorphic prism from preview and review functions.
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => (S -> Option A, A -> S) -> PrismPrime PointerBrand S A
§Parameters
preview: The preview function.review: The review function.
§Returns
A new PrismPrime instance.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::PrismPrime,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
assert_eq!(ok_prism.preview(Ok(42)), Some(42));Sourcepub fn preview(&self, s: S) -> Option<A>
pub fn preview(&self, s: S) -> Option<A>
Preview the focus of the prism in a structure.
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => (&PrismPrime PointerBrand S A, S) -> Option A
§Parameters
&self: The monomorphic prism instance.s: The structure to preview.
§Returns
The focus value if it exists, or None if not.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::PrismPrime,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
assert_eq!(ok_prism.preview(Ok(42)), Some(42));
assert_eq!(ok_prism.preview(Err("error".to_string())), None);Sourcepub fn review(&self, a: A) -> S
pub fn review(&self, a: A) -> S
Review the focus into the structure.
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => (&PrismPrime PointerBrand S A, A) -> S
§Parameters
&self: The monomorphic prism instance.a: The focus value.
§Returns
The structure containing the focus value.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::PrismPrime,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
assert_eq!(ok_prism.review(42), Ok(42));Sourcepub fn modify(&self, s: S, f: impl Fn(A) -> A) -> S
pub fn modify(&self, s: S, f: impl Fn(A) -> A) -> S
Modify the focus if it exists.
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => (&PrismPrime PointerBrand S A, S, A -> A) -> S
§Parameters
&self: The monomorphic prism instance.s: The structure to update.f: The function to apply to the focus.
§Returns
The updated structure.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::PrismPrime,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
assert_eq!(ok_prism.modify(Ok(21), |x| x * 2), Ok(42));
assert_eq!(ok_prism.modify(Err("error".to_string()), |x| x * 2), Err("error".to_string()));Trait Implementations§
Source§impl<'a, PointerBrand, S: 'a, A: 'a> AffineTraversalOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S: 'a, A: 'a> AffineTraversalOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn evaluate<Q: Strong + Choice>(
&self,
pab: <Q as Kind_266801a817966495>::Of<'a, A, A>,
) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate<Q: Strong + Choice>( &self, pab: <Q as Kind_266801a817966495>::Of<'a, A, A>, ) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall PointerBrand S A Q. (Strong Q, Choice Q, ToDynCloneFn PointerBrand) => (&PrismPrime PointerBrand S A, Q A A) -> Q S S
§Type Parameters
Q: The profunctor type.
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use {
fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
},
std::rc::Rc,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let modifier: Rc<dyn Fn(Result<i32, String>) -> Result<i32, String>> =
AffineTraversalOptic::evaluate::<RcFnBrand>(&ok_prism, f);
assert_eq!(modifier(Ok(21)), Ok(42));Source§impl<'a, PointerBrand, S, A> Clone for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
S: 'a,
A: 'a,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S, A> Clone for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
S: 'a,
A: 'a,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => &PrismPrime PointerBrand S A -> PrismPrime PointerBrand S A
§Returns
A new PrismPrime instance that is a copy of the original.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::PrismPrime,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let cloned = ok_prism.clone();
assert_eq!(cloned.preview(Ok(42)), Some(42));1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, PointerBrand, S: 'a, A: 'a> FoldOptic<'a, S, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S: 'a, A: 'a> FoldOptic<'a, S, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn evaluate<R: 'a + Monoid + 'static, Q: ToDynCloneFn + 'static>(
&self,
pab: <ForgetBrand<Q, R> as Kind_266801a817966495>::Of<'a, A, A>,
) -> <ForgetBrand<Q, R> as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate<R: 'a + Monoid + 'static, Q: ToDynCloneFn + 'static>( &self, pab: <ForgetBrand<Q, R> as Kind_266801a817966495>::Of<'a, A, A>, ) -> <ForgetBrand<Q, R> as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall PointerBrand S A R Q. (Monoid R, ToDynCloneFn Q, ToDynCloneFn PointerBrand) => (&PrismPrime PointerBrand S A, Forget Q R A A) -> Forget Q R S S
§Type Parameters
R: The monoid type.Q: The reference-counted pointer type for the Forget brand.
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = Forget::<RcBrand, String, i32, i32>::new(|x| x.to_string());
let folded = FoldOptic::evaluate(&ok_prism, f);
assert_eq!(folded.run(Ok(42)), "42".to_string());Source§impl<'a, Q, PointerBrand, S, A> Optic<'a, Q, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
Q: Choice,
PointerBrand: ToDynCloneFn,
S: 'a,
A: 'a,
§Type Parameters
'a: The lifetime of the values.
Q: The profunctor type.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, Q, PointerBrand, S, A> Optic<'a, Q, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
Q: Choice,
PointerBrand: ToDynCloneFn,
S: 'a,
A: 'a,
§Type Parameters
'a: The lifetime of the values.Q: The profunctor type.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn evaluate(
&self,
pab: <Q as Kind_266801a817966495>::Of<'a, A, A>,
) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate( &self, pab: <Q as Kind_266801a817966495>::Of<'a, A, A>, ) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall Q PointerBrand S A. (Choice Q, ToDynCloneFn PointerBrand) => (&PrismPrime Q PointerBrand S A, Q A A) -> Q S S
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let modifier = Optic::<RcFnBrand, _, _, _, _>::evaluate(&ok_prism, f);
assert_eq!(modifier(Ok(21)), Ok(42));
assert_eq!(modifier(Err("error".to_string())), Err("error".to_string()));Source§impl<'a, PointerBrand, S: 'a, A: 'a> PrismOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S: 'a, A: 'a> PrismOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn evaluate<Q: Choice>(
&self,
pab: <Q as Kind_266801a817966495>::Of<'a, A, A>,
) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate<Q: Choice>( &self, pab: <Q as Kind_266801a817966495>::Of<'a, A, A>, ) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall PointerBrand S A Q. (Choice Q, ToDynCloneFn PointerBrand) => (&PrismPrime PointerBrand S A, Q A A) -> Q S S
§Type Parameters
Q: The profunctor type.
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use {
fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
},
std::rc::Rc,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let modifier: Rc<dyn Fn(Result<i32, String>) -> Result<i32, String>> =
PrismOptic::evaluate::<RcFnBrand>(&ok_prism, f);
assert_eq!(modifier(Ok(21)), Ok(42));Source§impl<'a, PointerBrand, S: 'a, A: 'a> ReviewOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S: 'a, A: 'a> ReviewOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn evaluate(
&self,
pab: <TaggedBrand as Kind_266801a817966495>::Of<'a, A, A>,
) -> <TaggedBrand as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate( &self, pab: <TaggedBrand as Kind_266801a817966495>::Of<'a, A, A>, ) -> <TaggedBrand as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall PointerBrand S A. ToDynCloneFn PointerBrand => (&PrismPrime PointerBrand S A, Tagged A A) -> Tagged S S
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = Tagged::new(42);
let reviewed = ReviewOptic::evaluate(&ok_prism, f);
assert_eq!(reviewed.0, Ok(42));Source§impl<'a, Q, PointerBrand, S: 'a, A: 'a> SetterOptic<'a, Q, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
Q: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
Q: The reference-counted pointer type for the setter brand.
PointerBrand: The reference-counted pointer type for the prism.
S: The type of the structure.
A: The type of the focus.
impl<'a, Q, PointerBrand, S: 'a, A: 'a> SetterOptic<'a, Q, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
Q: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.Q: The reference-counted pointer type for the setter brand.PointerBrand: The reference-counted pointer type for the prism.S: The type of the structure.A: The type of the focus.
Source§fn evaluate(
&self,
pab: <FnBrand<Q> as Kind_266801a817966495>::Of<'a, A, A>,
) -> <FnBrand<Q> as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate( &self, pab: <FnBrand<Q> as Kind_266801a817966495>::Of<'a, A, A>, ) -> <FnBrand<Q> as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall Q PointerBrand S A. (ToDynCloneFn PointerBrand, ToDynCloneFn Q) => (&PrismPrime Q PointerBrand S A, Fn Q A A) -> Fn Q S S
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use {
fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
},
std::rc::Rc,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let modifier: Rc<dyn Fn(Result<i32, String>) -> Result<i32, String>> =
SetterOptic::<RcBrand, _, _, _, _>::evaluate(&ok_prism, f);
assert_eq!(modifier(Ok(21)), Ok(42));Source§impl<'a, PointerBrand, S: 'a, A: 'a> TraversalOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.
PointerBrand: The reference-counted pointer type.
S: The type of the structure.
A: The type of the focus.
impl<'a, PointerBrand, S: 'a, A: 'a> TraversalOptic<'a, S, S, A, A> for PrismPrime<'a, PointerBrand, S, A>where
PointerBrand: ToDynCloneFn,
§Type Parameters
'a: The lifetime of the values.PointerBrand: The reference-counted pointer type.S: The type of the structure.A: The type of the focus.
Source§fn evaluate<Q: Wander>(
&self,
pab: <Q as Kind_266801a817966495>::Of<'a, A, A>,
) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
fn evaluate<Q: Wander>( &self, pab: <Q as Kind_266801a817966495>::Of<'a, A, A>, ) -> <Q as Kind_266801a817966495>::Of<'a, S, S>
§Type Signature
forall PointerBrand S A Q. (Wander Q, ToDynCloneFn PointerBrand) => (&PrismPrime PointerBrand S A, Q A A) -> Q S S
§Type Parameters
Q: The profunctor type.
§Parameters
&self: The monomorphic prism instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use {
fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
},
std::rc::Rc,
};
let ok_prism: PrismPrime<RcBrand, Result<i32, String>, i32> =
PrismPrime::from_option(|r: Result<i32, String>| r.ok(), |x| Ok(x));
let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let modifier: Rc<dyn Fn(Result<i32, String>) -> Result<i32, String>> =
TraversalOptic::evaluate::<RcFnBrand>(&ok_prism, f);
assert_eq!(modifier(Ok(21)), Ok(42));Auto Trait Implementations§
impl<'a, PointerBrand, S, A> Freeze for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: Freeze,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: Freeze,
impl<'a, PointerBrand, S, A> RefUnwindSafe for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: RefUnwindSafe,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: RefUnwindSafe,
impl<'a, PointerBrand, S, A> Send for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: Send,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: Send,
impl<'a, PointerBrand, S, A> Sync for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: Sync,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: Sync,
impl<'a, PointerBrand, S, A> Unpin for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: Unpin,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: Unpin,
impl<'a, PointerBrand, S, A> UnsafeUnpin for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: UnsafeUnpin,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: UnsafeUnpin,
impl<'a, PointerBrand, S, A> UnwindSafe for PrismPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(S) -> Result<A, S> + 'a>: UnwindSafe,
<PointerBrand as RefCountedPointer>::Of<'a, dyn Fn(A) -> S + 'a>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more