1#[fp_macros::document_module]
4mod inner {
5 use {
6 crate::{
7 Apply,
8 brands::{
9 FnBrand,
10 optics::*,
11 },
12 classes::{
13 CloneableFn,
14 UnsizedCoercible,
15 monoid::Monoid,
16 optics::*,
17 profunctor::{
18 Choice,
19 Closed,
20 Profunctor,
21 Strong,
22 Wander,
23 },
24 },
25 kinds::*,
26 types::optics::Tagged,
27 },
28 fp_macros::*,
29 };
30
31 #[document_type_parameters(
37 "The lifetime of the values.",
38 "The reference-counted pointer type.",
39 "The source type of the structure.",
40 "The target type of the structure after an update.",
41 "The source type of the focus.",
42 "The target type of the focus after an update."
43 )]
44 pub struct Iso<'a, PointerBrand, S, T, A, B>
45 where
46 PointerBrand: UnsizedCoercible,
47 S: 'a,
48 T: 'a,
49 A: 'a,
50 B: 'a, {
51 pub from: Apply!(<FnBrand<PointerBrand> as Kind!( type Of<'b, U: 'b, V: 'b>: 'b; )>::Of<'a, S, A>),
53 pub to: Apply!(<FnBrand<PointerBrand> as Kind!( type Of<'b, U: 'b, V: 'b>: 'b; )>::Of<'a, B, T>),
55 }
56
57 #[document_type_parameters(
58 "The lifetime of the values.",
59 "The reference-counted pointer type.",
60 "The source type of the structure.",
61 "The target type of the structure after an update.",
62 "The source type of the focus.",
63 "The target type of the focus after an update."
64 )]
65 #[document_parameters("The iso instance.")]
66 impl<'a, PointerBrand, S, T, A, B> Clone for Iso<'a, PointerBrand, S, T, A, B>
67 where
68 PointerBrand: UnsizedCoercible,
69 S: 'a,
70 T: 'a,
71 A: 'a,
72 B: 'a,
73 {
74 #[document_signature]
75 #[document_returns("A new `Iso` instance that is a copy of the original.")]
76 #[document_examples]
77 fn clone(&self) -> Self {
90 Iso {
91 from: self.from.clone(),
92 to: self.to.clone(),
93 }
94 }
95 }
96
97 #[document_type_parameters(
98 "The lifetime of the values.",
99 "The reference-counted pointer type.",
100 "The source type of the structure.",
101 "The target type of the structure after an update.",
102 "The source type of the focus.",
103 "The target type of the focus after an update."
104 )]
105 #[document_parameters("The iso instance.")]
106 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> Iso<'a, PointerBrand, S, T, A, B>
107 where
108 PointerBrand: UnsizedCoercible,
109 {
110 #[document_signature]
112 #[document_parameters(
114 "The forward conversion function.",
115 "The backward conversion function."
116 )]
117 #[document_returns("A new instance of the type.")]
119 #[document_examples]
120 pub fn new(
133 from: impl 'a + Fn(S) -> A,
134 to: impl 'a + Fn(B) -> T,
135 ) -> Self {
136 Iso {
137 from: <FnBrand<PointerBrand> as CloneableFn>::new(from),
138 to: <FnBrand<PointerBrand> as CloneableFn>::new(to),
139 }
140 }
141
142 #[document_signature]
144 #[document_parameters("The structure to convert.")]
146 #[document_returns("The focus value.")]
148 #[document_examples]
150 pub fn from(
163 &self,
164 s: S,
165 ) -> A {
166 (self.from)(s)
167 }
168
169 #[document_signature]
171 #[document_parameters("The focus value to convert.")]
173 #[document_returns("The structure value.")]
175 #[document_examples]
177 pub fn to(
190 &self,
191 b: B,
192 ) -> T {
193 (self.to)(b)
194 }
195 }
196
197 #[document_type_parameters(
198 "The lifetime of the values.",
199 "The profunctor type.",
200 "The reference-counted pointer type.",
201 "The source type of the structure.",
202 "The target type of the structure after an update.",
203 "The source type of the focus.",
204 "The target type of the focus after an update."
205 )]
206 #[document_parameters("The iso instance.")]
207 impl<'a, Q, PointerBrand, S, T, A, B> Optic<'a, Q, S, T, A, B> for Iso<'a, PointerBrand, S, T, A, B>
208 where
209 Q: Profunctor,
210 PointerBrand: UnsizedCoercible,
211 S: 'a,
212 T: 'a,
213 A: 'a,
214 B: 'a,
215 {
216 #[document_signature]
217 #[document_parameters("The profunctor value to transform.")]
218 #[document_returns("The transformed profunctor value.")]
219 #[document_examples]
220 fn evaluate(
238 &self,
239 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
240 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
241 let from = self.from.clone();
242 let to = self.to.clone();
243
244 Q::dimap(move |s| from(s), move |b| to(b), pab)
247 }
248 }
249
250 #[document_type_parameters(
251 "The lifetime of the values.",
252 "The reference-counted pointer type.",
253 "The source type of the structure.",
254 "The target type of the structure after an update.",
255 "The source type of the focus.",
256 "The target type of the focus after an update."
257 )]
258 #[document_parameters("The iso instance.")]
259 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> IsoOptic<'a, S, T, A, B>
260 for Iso<'a, PointerBrand, S, T, A, B>
261 where
262 PointerBrand: UnsizedCoercible,
263 {
264 #[document_signature]
265 #[document_type_parameters("The profunctor type.")]
266 #[document_parameters("The profunctor value to transform.")]
267 #[document_returns("The transformed profunctor value.")]
268 #[document_examples]
269 fn evaluate<Q: Profunctor + 'static>(
287 &self,
288 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
289 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
290 Optic::<Q, S, T, A, B>::evaluate(self, pab)
291 }
292 }
293
294 #[document_type_parameters(
295 "The lifetime of the values.",
296 "The reference-counted pointer type.",
297 "The source type of the structure.",
298 "The target type of the structure after an update.",
299 "The source type of the focus.",
300 "The target type of the focus after an update."
301 )]
302 #[document_parameters("The iso instance.")]
303 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> AffineTraversalOptic<'a, S, T, A, B>
304 for Iso<'a, PointerBrand, S, T, A, B>
305 where
306 PointerBrand: UnsizedCoercible,
307 {
308 #[document_signature]
309 #[document_type_parameters("The profunctor type.")]
310 #[document_parameters("The profunctor value to transform.")]
311 #[document_returns("The transformed profunctor value.")]
312 #[document_examples]
313 fn evaluate<Q: Strong + Choice>(
332 &self,
333 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
334 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
335 Optic::<Q, S, T, A, B>::evaluate(self, pab)
336 }
337 }
338
339 #[document_type_parameters(
340 "The lifetime of the values.",
341 "The cloneable function brand used by the profunctor's `Closed` instance.",
342 "The reference-counted pointer type.",
343 "The source type of the structure.",
344 "The target type of the structure after an update.",
345 "The source type of the focus.",
346 "The target type of the focus after an update."
347 )]
348 #[document_parameters("The iso instance.")]
349 impl<'a, FunctionBrand: CloneableFn, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a>
350 GrateOptic<'a, FunctionBrand, S, T, A, B> for Iso<'a, PointerBrand, S, T, A, B>
351 where
352 PointerBrand: UnsizedCoercible,
353 {
354 #[document_signature]
355 #[document_type_parameters("The profunctor type.")]
356 #[document_parameters("The profunctor value to transform.")]
357 #[document_returns("The transformed profunctor value.")]
358 #[document_examples]
359 fn evaluate<Q: Closed<FunctionBrand>>(
378 &self,
379 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
380 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
381 Optic::<Q, S, T, A, B>::evaluate(self, pab)
382 }
383 }
384
385 #[document_type_parameters(
386 "The lifetime of the values.",
387 "The reference-counted pointer type.",
388 "The source type of the structure.",
389 "The target type of the structure after an update.",
390 "The source type of the focus.",
391 "The target type of the focus after an update."
392 )]
393 #[document_parameters("The iso instance.")]
394 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> LensOptic<'a, S, T, A, B>
395 for Iso<'a, PointerBrand, S, T, A, B>
396 where
397 PointerBrand: UnsizedCoercible,
398 {
399 #[document_signature]
400 #[document_type_parameters("The profunctor type.")]
401 #[document_parameters("The profunctor value to transform.")]
402 #[document_returns("The transformed profunctor value.")]
403 #[document_examples]
404 fn evaluate<Q: Strong>(
422 &self,
423 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
424 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
425 Optic::<Q, S, T, A, B>::evaluate(self, pab)
426 }
427 }
428
429 #[document_type_parameters(
430 "The lifetime of the values.",
431 "The reference-counted pointer type.",
432 "The source type of the structure.",
433 "The target type of the structure after an update.",
434 "The source type of the focus.",
435 "The target type of the focus after an update."
436 )]
437 #[document_parameters("The iso instance.")]
438 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> PrismOptic<'a, S, T, A, B>
439 for Iso<'a, PointerBrand, S, T, A, B>
440 where
441 PointerBrand: UnsizedCoercible,
442 {
443 #[document_signature]
444 #[document_type_parameters("The profunctor type.")]
445 #[document_parameters("The profunctor value to transform.")]
446 #[document_returns("The transformed profunctor value.")]
447 #[document_examples]
448 fn evaluate<Q: Choice>(
467 &self,
468 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
469 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
470 Optic::<Q, S, T, A, B>::evaluate(self, pab)
471 }
472 }
473
474 #[document_type_parameters(
475 "The lifetime of the values.",
476 "The reference-counted pointer type.",
477 "The source type of the structure.",
478 "The target type of the structure after an update.",
479 "The source type of the focus.",
480 "The target type of the focus after an update."
481 )]
482 #[document_parameters("The iso instance.")]
483 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> TraversalOptic<'a, S, T, A, B>
484 for Iso<'a, PointerBrand, S, T, A, B>
485 where
486 PointerBrand: UnsizedCoercible,
487 {
488 #[document_signature]
489 #[document_type_parameters("The profunctor type.")]
490 #[document_parameters("The profunctor value to transform.")]
491 #[document_returns("The transformed profunctor value.")]
492 #[document_examples]
493 fn evaluate<Q: Wander>(
512 &self,
513 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
514 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
515 Optic::<Q, S, T, A, B>::evaluate(self, pab)
516 }
517 }
518
519 #[document_type_parameters(
520 "The lifetime of the values.",
521 "The reference-counted pointer type.",
522 "The source type of the structure.",
523 "The focus type."
524 )]
525 #[document_parameters("The iso instance.")]
526 impl<'a, PointerBrand, S: 'a, A: 'a> GetterOptic<'a, S, A> for Iso<'a, PointerBrand, S, S, A, A>
527 where
528 PointerBrand: UnsizedCoercible,
529 {
530 #[document_signature]
531 #[document_type_parameters(
532 "The return type of the forget profunctor.",
533 "The reference-counted pointer type."
534 )]
535 #[document_parameters("The profunctor value to transform.")]
536 #[document_returns("The transformed profunctor value.")]
537 #[document_examples]
538 fn evaluate<R: 'a + 'static, Q: UnsizedCoercible + 'static>(
556 &self,
557 pab: Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
558 ) -> Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>)
559 {
560 IsoOptic::evaluate::<ForgetBrand<Q, R>>(self, pab)
561 }
562 }
563
564 #[document_type_parameters(
565 "The lifetime of the values.",
566 "The reference-counted pointer type.",
567 "The source type of the structure.",
568 "The focus type."
569 )]
570 #[document_parameters("The iso instance.")]
571 impl<'a, PointerBrand, S: 'a, A: 'a> FoldOptic<'a, S, A> for Iso<'a, PointerBrand, S, S, A, A>
572 where
573 PointerBrand: UnsizedCoercible,
574 {
575 #[document_signature]
576 #[document_type_parameters("The monoid type.", "The reference-counted pointer type.")]
577 #[document_parameters("The profunctor value to transform.")]
578 #[document_returns("The transformed profunctor value.")]
579 #[document_examples]
580 fn evaluate<R: 'a + Monoid + 'static, Q: UnsizedCoercible + 'static>(
598 &self,
599 pab: Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
600 ) -> Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>)
601 {
602 IsoOptic::evaluate::<ForgetBrand<Q, R>>(self, pab)
603 }
604 }
605
606 #[document_type_parameters(
607 "The lifetime of the values.",
608 "The reference-counted pointer type for the setter brand.",
609 "The reference-counted pointer type for the iso.",
610 "The source type of the structure.",
611 "The target type of the structure after an update.",
612 "The source type of the focus.",
613 "The target type of the focus after an update."
614 )]
615 #[document_parameters("The iso instance.")]
616 impl<'a, Q, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> SetterOptic<'a, Q, S, T, A, B>
617 for Iso<'a, PointerBrand, S, T, A, B>
618 where
619 PointerBrand: UnsizedCoercible,
620 Q: UnsizedCoercible,
621 {
622 #[document_signature]
623 #[document_parameters("The profunctor value to transform.")]
624 #[document_returns("The transformed profunctor value.")]
625 #[document_examples]
626 fn evaluate(
645 &self,
646 pab: Apply!(<FnBrand<Q> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
647 ) -> Apply!(<FnBrand<Q> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
648 IsoOptic::evaluate::<FnBrand<Q>>(self, pab)
649 }
650 }
651
652 #[document_type_parameters(
653 "The lifetime of the values.",
654 "The reference-counted pointer type.",
655 "The source type of the structure.",
656 "The target type of the structure after an update.",
657 "The source type of the focus.",
658 "The target type of the focus after an update."
659 )]
660 #[document_parameters("The iso instance.")]
661 impl<'a, PointerBrand, S: 'a, T: 'a, A: 'a, B: 'a> ReviewOptic<'a, S, T, A, B>
662 for Iso<'a, PointerBrand, S, T, A, B>
663 where
664 PointerBrand: UnsizedCoercible,
665 {
666 #[document_signature]
667 #[document_parameters("The profunctor value to transform.")]
668 #[document_returns("The transformed profunctor value.")]
669 #[document_examples]
670 fn evaluate(
688 &self,
689 pab: Apply!(<TaggedBrand as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, B>),
690 ) -> Apply!(<TaggedBrand as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, T>) {
691 let to = self.to.clone();
692 Tagged::new(to(pab.0))
693 }
694 }
695
696 #[document_type_parameters(
701 "The lifetime of the values.",
702 "The reference-counted pointer type.",
703 "The type of the structure.",
704 "The type of the focus."
705 )]
706 pub struct IsoPrime<'a, PointerBrand, S, A>
707 where
708 PointerBrand: UnsizedCoercible,
709 S: 'a,
710 A: 'a, {
711 pub(crate) from_fn: Apply!(<FnBrand<PointerBrand> as Kind!( type Of<'b, U: 'b, V: 'b>: 'b; )>::Of<'a, S, A>),
712 pub(crate) to_fn: Apply!(<FnBrand<PointerBrand> as Kind!( type Of<'b, U: 'b, V: 'b>: 'b; )>::Of<'a, A, S>),
713 }
714
715 #[document_type_parameters(
716 "The lifetime of the values.",
717 "The reference-counted pointer type.",
718 "The type of the structure.",
719 "The type of the focus."
720 )]
721 #[document_parameters("The iso instance.")]
722 impl<'a, PointerBrand, S, A> Clone for IsoPrime<'a, PointerBrand, S, A>
723 where
724 PointerBrand: UnsizedCoercible,
725 S: 'a,
726 A: 'a,
727 {
728 #[document_signature]
729 #[document_returns("A new `IsoPrime` instance that is a copy of the original.")]
730 #[document_examples]
731 fn clone(&self) -> Self {
743 IsoPrime {
744 from_fn: self.from_fn.clone(),
745 to_fn: self.to_fn.clone(),
746 }
747 }
748 }
749
750 #[document_type_parameters(
751 "The lifetime of the values.",
752 "The reference-counted pointer type.",
753 "The type of the structure.",
754 "The type of the focus."
755 )]
756 #[document_parameters("The monomorphic iso instance.")]
757 impl<'a, PointerBrand, S: 'a, A: 'a> IsoPrime<'a, PointerBrand, S, A>
758 where
759 PointerBrand: UnsizedCoercible,
760 {
761 #[document_signature]
763 #[document_parameters(
765 "The forward conversion function.",
766 "The backward conversion function."
767 )]
768 #[document_returns("A new instance of the type.")]
770 #[document_examples]
771 pub fn new(
783 from: impl 'a + Fn(S) -> A,
784 to: impl 'a + Fn(A) -> S,
785 ) -> Self {
786 IsoPrime {
787 from_fn: <FnBrand<PointerBrand> as CloneableFn>::new(from),
788 to_fn: <FnBrand<PointerBrand> as CloneableFn>::new(to),
789 }
790 }
791
792 #[document_signature]
794 #[document_parameters("The structure to convert.")]
796 #[document_returns("The focus value.")]
798 #[document_examples]
800 pub fn from(
811 &self,
812 s: S,
813 ) -> A {
814 (self.from_fn)(s)
815 }
816
817 #[document_signature]
819 #[document_parameters("The focus value to convert.")]
821 #[document_returns("The structure value.")]
823 #[document_examples]
825 pub fn to(
836 &self,
837 a: A,
838 ) -> S {
839 (self.to_fn)(a)
840 }
841
842 #[document_signature]
844 #[document_returns(
846 "A new `IsoPrime` instance with the forward and backward conversions swapped."
847 )]
848 #[document_examples]
850 pub fn reversed(&self) -> IsoPrime<'a, PointerBrand, A, S> {
863 IsoPrime {
864 from_fn: self.to_fn.clone(),
865 to_fn: self.from_fn.clone(),
866 }
867 }
868 }
869
870 #[document_type_parameters(
872 "The lifetime of the values.",
873 "The profunctor type.",
874 "The reference-counted pointer type.",
875 "The type of the structure.",
876 "The type of the focus."
877 )]
878 #[document_parameters("The monomorphic iso instance.")]
879 impl<'a, Q, PointerBrand, S, A> Optic<'a, Q, S, S, A, A> for IsoPrime<'a, PointerBrand, S, A>
880 where
881 Q: Profunctor,
882 PointerBrand: UnsizedCoercible,
883 S: 'a,
884 A: 'a,
885 {
886 #[document_signature]
887 #[document_parameters("The profunctor value to transform.")]
888 #[document_returns("The transformed profunctor value.")]
889 #[document_examples]
890 fn evaluate(
908 &self,
909 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
910 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
911 let from_fn = self.from_fn.clone();
912 let to_fn = self.to_fn.clone();
913
914 Q::dimap(move |s| from_fn(s), move |a| to_fn(a), pab)
917 }
918 }
919
920 #[document_type_parameters(
921 "The lifetime of the values.",
922 "The reference-counted pointer type.",
923 "The type of the structure.",
924 "The type of the focus."
925 )]
926 #[document_parameters("The monomorphic iso instance.")]
927 impl<'a, PointerBrand, S: 'a, A: 'a> AffineTraversalOptic<'a, S, S, A, A>
928 for IsoPrime<'a, PointerBrand, S, A>
929 where
930 PointerBrand: UnsizedCoercible,
931 {
932 #[document_signature]
933 #[document_type_parameters("The profunctor type.")]
934 #[document_parameters("The profunctor value to transform.")]
935 #[document_returns("The transformed profunctor value.")]
936 #[document_examples]
937 fn evaluate<Q: Strong + Choice>(
956 &self,
957 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
958 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
959 Optic::<Q, S, S, A, A>::evaluate(self, pab)
960 }
961 }
962
963 #[document_type_parameters(
964 "The lifetime of the values.",
965 "The cloneable function brand used by the profunctor's `Closed` instance.",
966 "The reference-counted pointer type.",
967 "The type of the structure.",
968 "The type of the focus."
969 )]
970 #[document_parameters("The monomorphic iso instance.")]
971 impl<'a, FunctionBrand: CloneableFn, PointerBrand, S: 'a, A: 'a>
972 GrateOptic<'a, FunctionBrand, S, S, A, A> for IsoPrime<'a, PointerBrand, S, A>
973 where
974 PointerBrand: UnsizedCoercible,
975 {
976 #[document_signature]
977 #[document_type_parameters("The profunctor type.")]
978 #[document_parameters("The profunctor value to transform.")]
979 #[document_returns("The transformed profunctor value.")]
980 #[document_examples]
981 fn evaluate<Q: Closed<FunctionBrand>>(
1000 &self,
1001 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1002 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1003 Optic::<Q, S, S, A, A>::evaluate(self, pab)
1004 }
1005 }
1006
1007 #[document_type_parameters(
1008 "The lifetime of the values.",
1009 "The reference-counted pointer type.",
1010 "The type of the structure.",
1011 "The type of the focus."
1012 )]
1013 #[document_parameters("The monomorphic iso instance.")]
1014 impl<'a, PointerBrand, S: 'a, A: 'a> LensOptic<'a, S, S, A, A> for IsoPrime<'a, PointerBrand, S, A>
1015 where
1016 PointerBrand: UnsizedCoercible,
1017 {
1018 #[document_signature]
1019 #[document_type_parameters("The profunctor type.")]
1020 #[document_parameters("The profunctor value to transform.")]
1021 #[document_returns("The transformed profunctor value.")]
1022 #[document_examples]
1023 fn evaluate<Q: Strong>(
1041 &self,
1042 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1043 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1044 Optic::<Q, S, S, A, A>::evaluate(self, pab)
1045 }
1046 }
1047
1048 #[document_type_parameters(
1049 "The lifetime of the values.",
1050 "The reference-counted pointer type.",
1051 "The type of the structure.",
1052 "The type of the focus."
1053 )]
1054 #[document_parameters("The monomorphic iso instance.")]
1055 impl<'a, PointerBrand, S: 'a, A: 'a> PrismOptic<'a, S, S, A, A> for IsoPrime<'a, PointerBrand, S, A>
1056 where
1057 PointerBrand: UnsizedCoercible,
1058 {
1059 #[document_signature]
1060 #[document_type_parameters("The profunctor type.")]
1061 #[document_parameters("The profunctor value to transform.")]
1062 #[document_returns("The transformed profunctor value.")]
1063 #[document_examples]
1064 fn evaluate<Q: Choice>(
1083 &self,
1084 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1085 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1086 Optic::<Q, S, S, A, A>::evaluate(self, pab)
1087 }
1088 }
1089
1090 #[document_type_parameters(
1091 "The lifetime of the values.",
1092 "The reference-counted pointer type.",
1093 "The type of the structure.",
1094 "The type of the focus."
1095 )]
1096 #[document_parameters("The monomorphic iso instance.")]
1097 impl<'a, PointerBrand, S: 'a, A: 'a> TraversalOptic<'a, S, S, A, A>
1098 for IsoPrime<'a, PointerBrand, S, A>
1099 where
1100 PointerBrand: UnsizedCoercible,
1101 {
1102 #[document_signature]
1103 #[document_type_parameters("The profunctor type.")]
1104 #[document_parameters("The profunctor value to transform.")]
1105 #[document_returns("The transformed profunctor value.")]
1106 #[document_examples]
1107 fn evaluate<Q: Wander>(
1126 &self,
1127 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1128 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1129 Optic::<Q, S, S, A, A>::evaluate(self, pab)
1130 }
1131 }
1132
1133 #[document_type_parameters(
1134 "The lifetime of the values.",
1135 "The reference-counted pointer type.",
1136 "The type of the structure.",
1137 "The type of the focus."
1138 )]
1139 #[document_parameters("The monomorphic iso instance.")]
1140 impl<'a, PointerBrand, S: 'a, A: 'a> GetterOptic<'a, S, A> for IsoPrime<'a, PointerBrand, S, A>
1141 where
1142 PointerBrand: UnsizedCoercible,
1143 {
1144 #[document_signature]
1145 #[document_type_parameters(
1146 "The return type of the forget profunctor.",
1147 "The reference-counted pointer type."
1148 )]
1149 #[document_parameters("The profunctor value to transform.")]
1150 #[document_returns("The transformed profunctor value.")]
1151 #[document_examples]
1152 fn evaluate<R: 'a + 'static, Q: UnsizedCoercible + 'static>(
1170 &self,
1171 pab: Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1172 ) -> Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>)
1173 {
1174 IsoOptic::evaluate::<ForgetBrand<Q, R>>(self, pab)
1175 }
1176 }
1177
1178 #[document_type_parameters(
1179 "The lifetime of the values.",
1180 "The reference-counted pointer type.",
1181 "The type of the structure.",
1182 "The type of the focus."
1183 )]
1184 #[document_parameters("The monomorphic iso instance.")]
1185 impl<'a, PointerBrand, S: 'a, A: 'a> FoldOptic<'a, S, A> for IsoPrime<'a, PointerBrand, S, A>
1186 where
1187 PointerBrand: UnsizedCoercible,
1188 {
1189 #[document_signature]
1190 #[document_type_parameters("The monoid type.", "The reference-counted pointer type.")]
1191 #[document_parameters("The profunctor value to transform.")]
1192 #[document_returns("The transformed profunctor value.")]
1193 #[document_examples]
1194 fn evaluate<R: 'a + Monoid + 'static, Q: UnsizedCoercible + 'static>(
1212 &self,
1213 pab: Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1214 ) -> Apply!(<ForgetBrand<Q, R> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>)
1215 {
1216 IsoOptic::evaluate::<ForgetBrand<Q, R>>(self, pab)
1217 }
1218 }
1219
1220 #[document_type_parameters(
1221 "The lifetime of the values.",
1222 "The reference-counted pointer type for the setter brand.",
1223 "The reference-counted pointer type for the iso.",
1224 "The type of the structure.",
1225 "The type of the focus."
1226 )]
1227 #[document_parameters("The monomorphic iso instance.")]
1228 impl<'a, Q, PointerBrand, S: 'a, A: 'a> SetterOptic<'a, Q, S, S, A, A>
1229 for IsoPrime<'a, PointerBrand, S, A>
1230 where
1231 PointerBrand: UnsizedCoercible,
1232 Q: UnsizedCoercible,
1233 {
1234 #[document_signature]
1235 #[document_parameters("The profunctor value to transform.")]
1236 #[document_returns("The transformed profunctor value.")]
1237 #[document_examples]
1238 fn evaluate(
1257 &self,
1258 pab: Apply!(<FnBrand<Q> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1259 ) -> Apply!(<FnBrand<Q> as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1260 IsoOptic::evaluate::<FnBrand<Q>>(self, pab)
1261 }
1262 }
1263
1264 #[document_type_parameters(
1265 "The lifetime of the values.",
1266 "The reference-counted pointer type.",
1267 "The type of the structure.",
1268 "The type of the focus."
1269 )]
1270 #[document_parameters("The monomorphic iso instance.")]
1271 impl<'a, PointerBrand, S: 'a, A: 'a> ReviewOptic<'a, S, S, A, A>
1272 for IsoPrime<'a, PointerBrand, S, A>
1273 where
1274 PointerBrand: UnsizedCoercible,
1275 {
1276 #[document_signature]
1277 #[document_parameters("The profunctor value to transform.")]
1278 #[document_returns("The transformed profunctor value.")]
1279 #[document_examples]
1280 fn evaluate(
1298 &self,
1299 pab: Apply!(<TaggedBrand as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1300 ) -> Apply!(<TaggedBrand as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1301 let to_fn = self.to_fn.clone();
1302 Tagged::new(to_fn(pab.0))
1303 }
1304 }
1305
1306 #[document_type_parameters(
1307 "The lifetime of the values.",
1308 "The reference-counted pointer type.",
1309 "The type of the structure.",
1310 "The type of the focus."
1311 )]
1312 #[document_parameters("The monomorphic iso instance.")]
1313 impl<'a, PointerBrand, S: 'a, A: 'a> IsoOptic<'a, S, S, A, A> for IsoPrime<'a, PointerBrand, S, A>
1314 where
1315 PointerBrand: UnsizedCoercible,
1316 {
1317 #[document_signature]
1318 #[document_type_parameters("The profunctor type.")]
1319 #[document_parameters("The profunctor value to transform.")]
1320 #[document_returns("The transformed profunctor value.")]
1321 #[document_examples]
1322 fn evaluate<Q: Profunctor + 'static>(
1340 &self,
1341 pab: Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, A, A>),
1342 ) -> Apply!(<Q as Kind!( type Of<'b, T: 'b, U: 'b>: 'b; )>::Of<'a, S, S>) {
1343 Optic::<Q, S, S, A, A>::evaluate(self, pab)
1344 }
1345 }
1346}
1347pub use inner::*;