No either dev

Wed, 03 Sep 2025 21:03:47 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Wed, 03 Sep 2025 21:03:47 -0500
branch
dev
changeset 173
102421d462d1
parent 172
73608862ef54
child 174
53ab61a41d70

No either

src/instance.rs file | annotate | diff | comparison | revisions
src/nalgebra_support.rs file | annotate | diff | comparison | revisions
--- a/src/instance.rs	Wed Sep 03 20:52:21 2025 -0500
+++ b/src/instance.rs	Wed Sep 03 21:03:47 2025 -0500
@@ -344,20 +344,6 @@
         X: 'b,
         Self: 'b;
 
-    #[inline]
-    /// Evaluates `f` or `g` depending on whether a reference or owned value is available.
-    fn either<'b, R>(
-        self,
-        f: impl FnOnce(D::Decomposition<'b>) -> R,
-        _g: impl FnOnce(D::Reference<'b>) -> R,
-    ) -> R
-    where
-        X: 'b,
-        Self: 'b,
-    {
-        self.eval_decompose(f)
-    }
-
     /// Returns an owned instance of `X`, cloning or converting non-true instances when necessary.
     fn own(self) -> X::Principal;
 
@@ -387,14 +373,6 @@
 
 impl<X: Space> Instance<X, BasicDecomposition> for X {
     #[inline]
-    fn either<'b, R>(self, f: impl FnOnce(MyCow<'b, X>) -> R, _g: impl FnOnce(&'b X) -> R) -> R
-    where
-        Self: 'b,
-    {
-        f(MyCow::Owned(self))
-    }
-
-    #[inline]
     fn eval_ref<'b, R>(&'b self, f: impl FnOnce(&'b X) -> R) -> R
     where
         X: 'b,
@@ -427,14 +405,6 @@
 
 impl<'a, X: Space> Instance<X, BasicDecomposition> for &'a X {
     #[inline]
-    fn either<'b, R>(self, _f: impl FnOnce(MyCow<'b, X>) -> R, g: impl FnOnce(&'b X) -> R) -> R
-    where
-        Self: 'b,
-    {
-        g(self)
-    }
-
-    #[inline]
     fn eval_ref<'b, R>(&'b self, f: impl FnOnce(&'b X) -> R) -> R
     where
         X: 'b,
@@ -467,14 +437,6 @@
 
 impl<'a, X: Space> Instance<X, BasicDecomposition> for &'a mut X {
     #[inline]
-    fn either<'b, R>(self, _f: impl FnOnce(MyCow<'b, X>) -> R, g: impl FnOnce(&'b X) -> R) -> R
-    where
-        Self: 'b,
-    {
-        g(self)
-    }
-
-    #[inline]
     fn eval_ref<'b, R>(&'b self, f: impl FnOnce(&'b X) -> R) -> R
     where
         X: 'b,
@@ -507,14 +469,6 @@
 
 impl<'a, X: Space> Instance<X, BasicDecomposition> for MyCow<'a, X> {
     #[inline]
-    fn either<'b, R>(self, f: impl FnOnce(MyCow<'b, X>) -> R, _g: impl FnOnce(&'b X) -> R) -> R
-    where
-        Self: 'b,
-    {
-        f(self)
-    }
-
-    #[inline]
     fn eval_ref<'b, R>(&'b self, f: impl FnOnce(&'b X) -> R) -> R
     where
         X: 'b,
--- a/src/nalgebra_support.rs	Wed Sep 03 20:52:21 2025 -0500
+++ b/src/nalgebra_support.rs	Wed Sep 03 21:03:47 2025 -0500
@@ -146,19 +146,6 @@
     ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K, S2>,
 {
     #[inline]
-    fn either<'b, R>(
-        self,
-        f: impl FnOnce(MyCow<'b, OMatrix<E, M, K>>) -> R,
-        _g: impl FnOnce(MatrixView<'b, E, M, K, Dyn, Dyn>) -> R,
-    ) -> R
-    where
-        Self: 'b,
-    {
-        // TODO: should not turn non-owned matrices into owned
-        f(MyCow::Owned(self.into_owned()))
-    }
-
-    #[inline]
     fn eval_ref<'b, R>(
         &'b self,
         f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R,
@@ -203,18 +190,6 @@
     DefaultAllocator: Allocator<M, K>,
     ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K, S2>,
 {
-    #[inline]
-    fn either<'b, R>(
-        self,
-        _f: impl FnOnce(MyCow<'b, OMatrix<E, M, K>>) -> R,
-        g: impl FnOnce(MatrixView<'b, E, M, K, Dyn, Dyn>) -> R,
-    ) -> R
-    where
-        Self: 'b,
-    {
-        g(self.as_view())
-    }
-
     fn eval_ref<'b, R>(
         &'b self,
         f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R,
@@ -259,18 +234,6 @@
     ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K>,
 {
     #[inline]
-    fn either<'b, R>(
-        self,
-        f: impl FnOnce(MyCow<'b, OMatrix<E, M, K>>) -> R,
-        _g: impl FnOnce(MatrixView<'b, E, M, K, Dyn, Dyn>) -> R,
-    ) -> R
-    where
-        Self: 'b,
-    {
-        f(self)
-    }
-
-    #[inline]
     fn eval_ref<'b, R>(
         &'b self,
         f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R,

mercurial