--- a/src/direct_product.rs Wed Sep 03 19:55:05 2025 -0500 +++ b/src/direct_product.rs Wed Sep 03 20:19:41 2025 -0500 @@ -433,29 +433,12 @@ V: Instance<B, Q>, { #[inline] - fn eval_decompose<'b, R>( - self, - f: impl FnOnce(Pair<D::Decomposition<'b>, Q::Decomposition<'b>>) -> R, - ) -> R + fn eval_ref<'b, R>(&'b self, f: impl FnOnce(Pair<D::Reference<'b>, Q::Reference<'b>>) -> R) -> R where Pair<A, B>: 'b, Self: 'b, { - self.0 - .eval_decompose(|a| self.1.eval_decompose(|b| f(Pair(a, b)))) - } - - #[inline] - fn eval_ref_decompose<'b, R>( - &'b self, - f: impl FnOnce(Pair<D::Reference<'b>, Q::Reference<'b>>) -> R, - ) -> R - where - Pair<A, B>: 'b, - Self: 'b, - { - self.0 - .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) + self.0.eval_ref(|a| self.1.eval_ref(|b| f(Pair(a, b)))) } #[inline] @@ -470,6 +453,14 @@ fn own(self) -> Pair<A::Principal, B::Principal> { Pair(self.0.own(), self.1.own()) } + + #[inline] + fn decompose<'b>(self) -> Pair<D::Decomposition<'b>, Q::Decomposition<'b>> + where + Self: 'b, + { + Pair(self.0.decompose(), self.1.decompose()) + } } impl<'a, A, B, U, V, D, Q> Instance<Pair<A, B>, PairDecomposition<D, Q>> for &'a Pair<U, V> @@ -483,30 +474,12 @@ &'a U: Instance<A, D>, &'a V: Instance<B, Q>, { - fn eval_decompose<'b, R>( - self, - f: impl FnOnce(Pair<D::Decomposition<'b>, Q::Decomposition<'b>>) -> R, - ) -> R + fn eval_ref<'b, R>(&'b self, f: impl FnOnce(Pair<D::Reference<'b>, Q::Reference<'b>>) -> R) -> R where Pair<A, B>: 'b, Self: 'b, { - self.0.eval_ref_decompose(|a| { - self.1 - .eval_ref_decompose(|b| f(Pair(D::lift(a), Q::lift(b)))) - }) - } - - fn eval_ref_decompose<'b, R>( - &'b self, - f: impl FnOnce(Pair<D::Reference<'b>, Q::Reference<'b>>) -> R, - ) -> R - where - Pair<A, B>: 'b, - Self: 'b, - { - self.0 - .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) + self.0.eval_ref(|a| self.1.eval_ref(|b| f(Pair(a, b)))) } #[inline] @@ -522,6 +495,15 @@ let Pair(ref u, ref v) = self; Pair(u.own(), v.own()) } + + #[inline] + fn decompose<'b>(self) -> Pair<D::Decomposition<'b>, Q::Decomposition<'b>> + where + Self: 'b, + { + let Pair(u, v) = self; + Pair(u.decompose(), v.decompose()) + } } impl<A, B, D, Q> DecompositionMut<Pair<A, B>> for PairDecomposition<D, Q>