src/instance.rs

branch
dev
changeset 164
fd9dba51afd3
parent 163
b4a47e8e80d1
child 165
478c23ce7cef
--- a/src/instance.rs	Wed Sep 03 09:52:30 2025 -0500
+++ b/src/instance.rs	Wed Sep 03 10:08:28 2025 -0500
@@ -113,8 +113,9 @@
 }
 
 /// Trait for abitrary mathematical spaces.
-pub trait Space: Ownable<OwnedVariant = Self::OwnedSpace> + Sized {
-    type OwnedSpace: ClosedSpace;
+pub trait Space: Ownable<OwnedVariant = Self::Principal> + Sized {
+    /// Principal, typically owned realisation of the space.
+    type Principal: ClosedSpace;
 
     /// Default decomposition for the space
     type Decomp: Decomposition<Self>;
@@ -131,8 +132,8 @@
 
 /// Helper trait for working with closed spaces, operations in which should
 /// return members of the same space
-pub trait ClosedSpace: Space<OwnedSpace = Self> + Owned + Instance<Self> {}
-impl<X: Space<OwnedSpace = Self> + Owned + Instance<Self>> ClosedSpace for X {}
+pub trait ClosedSpace: Space<Principal = Self> + Owned + Instance<Self> {}
+impl<X: Space<Principal = Self> + Owned + Instance<Self>> ClosedSpace for X {}
 
 #[macro_export]
 macro_rules! impl_basic_space {
@@ -141,7 +142,7 @@
     };
     ($type:ty where $($where:tt)*) => {
         impl<$($where)*> $crate::instance::Space for $type {
-            type OwnedSpace = Self;
+            type Principal = Self;
             type Decomp = $crate::instance::BasicDecomposition;
         }
 
@@ -215,7 +216,7 @@
 ///
 /// This is used, for example, by [`crate::mapping::Mapping::apply`].
 pub trait Instance<X, D = <X as Space>::Decomp>:
-    Sized + Ownable<OwnedVariant = X::OwnedSpace>
+    Sized + Ownable<OwnedVariant = X::Principal>
 where
     X: Space,
     D: Decomposition<X>,
@@ -235,7 +236,7 @@
         Self: 'b;
 
     /// Returns an owned instance of `X`, cloning or converting non-true instances when necessary.
-    fn own(self) -> X::OwnedSpace {
+    fn own(self) -> X::Principal {
         self.into_owned()
     }
 
@@ -244,7 +245,7 @@
     /// Returns an owned instance or reference to `X`, converting non-true instances when necessary.
     ///
     /// Default implementation uses [`Self::own`]. Consumes the input.
-    fn cow<'b>(self) -> MyCow<'b, X::OwnedSpace>
+    fn cow<'b>(self) -> MyCow<'b, X::Principal>
     where
         Self: 'b,
     {
@@ -255,7 +256,7 @@
     /// Evaluates `f` on a reference to self.
     ///
     /// Default implementation uses [`Self::cow`]. Consumes the input.
-    fn eval<'b, R>(self, f: impl FnOnce(&X::OwnedSpace) -> R) -> R
+    fn eval<'b, R>(self, f: impl FnOnce(&X::Principal) -> R) -> R
     where
         X: 'b,
         Self: 'b,
@@ -269,8 +270,8 @@
     /// Default implementation uses [`Self::cow`]. Consumes the input.
     fn either<'b, R>(
         self,
-        f: impl FnOnce(X::OwnedSpace) -> R,
-        g: impl FnOnce(&X::OwnedSpace) -> R,
+        f: impl FnOnce(X::Principal) -> R,
+        g: impl FnOnce(&X::Principal) -> R,
     ) -> R
     where
         Self: 'b,

mercurial