src/loc.rs

branch
dev
changeset 152
dab30b331f49
parent 151
402d717bb5c0
--- a/src/loc.rs	Mon Sep 01 20:55:34 2025 -0500
+++ b/src/loc.rs	Mon Sep 01 23:03:27 2025 -0500
@@ -4,7 +4,7 @@
 */
 
 use crate::euclidean::*;
-use crate::instance::{BasicDecomposition, Instance, Ownable};
+use crate::instance::{BasicDecomposition, Instance, MyCow, Ownable};
 use crate::linops::{Linear, Mapping, VectorSpace, AXPY};
 use crate::mapping::Space;
 use crate::maputil::{map1, map1_mut, map2, map2_mut, FixedLength, FixedLengthMut};
@@ -40,6 +40,21 @@
     fn clone_owned(&self) -> Self::OwnedVariant {
         self.clone()
     }
+
+    fn owned_cow<'b>(self) -> MyCow<'b, Self::OwnedVariant>
+    where
+        Self: 'b,
+    {
+        MyCow::Owned(self)
+    }
+
+    #[inline]
+    fn ref_owned_cow<'b>(&'b self) -> MyCow<'b, Self::OwnedVariant>
+    where
+        Self: 'b,
+    {
+        MyCow::Borrowed(self)
+    }
 }
 
 impl<F: Display, const N: usize> Display for Loc<N, F> {

mercurial