pub struct ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
S: 'a,
A: 'a,{
pub review_fn: <FnBrand<PointerBrand> as Kind_266801a817966495>::Of<'a, A, S>,
/* private fields */
}Expand description
A concrete review type where types do not change.
Matches PureScript’s Review' s 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.
Fields§
§review_fn: <FnBrand<PointerBrand> as Kind_266801a817966495>::Of<'a, A, S>Function to construct a structure from a focus value.
Implementations§
Source§impl<'a, PointerBrand, S, A> ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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> ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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.
Sourcepub fn new(review: impl 'a + Fn(A) -> S) -> Self
pub fn new(review: impl 'a + Fn(A) -> S) -> Self
Create a new monomorphic review.
§Type Signature
forall PointerBrand S A. UnsizedCoercible PointerBrand => (A -> S) -> ReviewPrime PointerBrand S A
§Parameters
review: The review function.
§Returns
A new instance of the type.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::ReviewPrime,
};
let r: ReviewPrime<RcBrand, Option<i32>, i32> = ReviewPrime::new(Some);
assert_eq!(r.review(42), Some(42));Sourcepub fn review(&self, a: A) -> S
pub fn review(&self, a: A) -> S
Review a focus value into a structure.
§Type Signature
forall PointerBrand S A. UnsizedCoercible PointerBrand => (&ReviewPrime PointerBrand S A, A) -> S
§Parameters
&self: The review instance.a: The focus value to review.
§Returns
The structure containing the focus value.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::ReviewPrime,
};
let r: ReviewPrime<RcBrand, Option<i32>, i32> = ReviewPrime::new(Some);
assert_eq!(r.review(42), Some(42));Trait Implementations§
Source§impl<'a, PointerBrand, S, A> Clone for ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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 ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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. UnsizedCoercible PointerBrand => &ReviewPrime PointerBrand S A -> ReviewPrime PointerBrand S A
§Returns
A new ReviewPrime instance that is a copy of the original.
§Examples
use fp_library::{
brands::RcBrand,
types::optics::ReviewPrime,
};
let r: ReviewPrime<RcBrand, Option<i32>, i32> = ReviewPrime::new(Some);
let cloned = r.clone();
assert_eq!(cloned.review(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> Optic<'a, TaggedBrand, S, S, A, A> for ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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> Optic<'a, TaggedBrand, S, S, A, A> for ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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 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. UnsizedCoercible PointerBrand => (&ReviewPrime PointerBrand S A, Tagged A A) -> Tagged S S
§Parameters
&self: The review instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
};
let r: ReviewPrime<RcBrand, Option<i32>, i32> = ReviewPrime::new(Some);
let f = Tagged::new(42);
let reviewed = Optic::<TaggedBrand, _, _, _, _>::evaluate(&r, f);
assert_eq!(reviewed.0, Some(42));Source§impl<'a, PointerBrand, S, A> ReviewOptic<'a, S, S, A, A> for ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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> ReviewOptic<'a, S, S, A, A> for ReviewPrime<'a, PointerBrand, S, A>where
PointerBrand: UnsizedCoercible,
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 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. UnsizedCoercible PointerBrand => (&ReviewPrime PointerBrand S A, Tagged A A) -> Tagged S S
§Parameters
&self: The review instance.pab: The profunctor value to transform.
§Returns
The transformed profunctor value.
§Examples
use fp_library::{
brands::{
optics::*,
*,
},
classes::optics::*,
functions::*,
types::optics::*,
};
let r: ReviewPrime<RcBrand, Option<i32>, i32> = ReviewPrime::new(Some);
let f = Tagged::new(42);
let reviewed = ReviewOptic::evaluate(&r, f);
assert_eq!(reviewed.0, Some(42));Auto Trait Implementations§
impl<'a, PointerBrand, S, A> Freeze for ReviewPrime<'a, PointerBrand, S, A>
impl<'a, PointerBrand, S, A> RefUnwindSafe for ReviewPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::CloneableOf<'a, dyn Fn(A) -> S + 'a>: RefUnwindSafe,
PointerBrand: RefUnwindSafe,
impl<'a, PointerBrand, S, A> Send for ReviewPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::CloneableOf<'a, dyn Fn(A) -> S + 'a>: Send,
PointerBrand: Send,
impl<'a, PointerBrand, S, A> Sync for ReviewPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::CloneableOf<'a, dyn Fn(A) -> S + 'a>: Sync,
PointerBrand: Sync,
impl<'a, PointerBrand, S, A> Unpin for ReviewPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::CloneableOf<'a, dyn Fn(A) -> S + 'a>: Unpin,
PointerBrand: Unpin,
impl<'a, PointerBrand, S, A> UnsafeUnpin for ReviewPrime<'a, PointerBrand, S, A>
impl<'a, PointerBrand, S, A> UnwindSafe for ReviewPrime<'a, PointerBrand, S, A>where
<PointerBrand as RefCountedPointer>::CloneableOf<'a, dyn Fn(A) -> S + 'a>: UnwindSafe,
PointerBrand: 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