diff --git a/crates/fj-kernel/src/algorithms/transform/mod.rs b/crates/fj-kernel/src/algorithms/transform/mod.rs index c61c5234e..2157917f4 100644 --- a/crates/fj-kernel/src/algorithms/transform/mod.rs +++ b/crates/fj-kernel/src/algorithms/transform/mod.rs @@ -69,7 +69,7 @@ pub trait TransformObject: Sized { impl TransformObject for Handle where - T: Clone + Insert + TransformObject + 'static, + T: Clone + Insert> + TransformObject + 'static, { fn transform_with_cache( self, diff --git a/crates/fj-kernel/src/operations/insert.rs b/crates/fj-kernel/src/operations/insert.rs index fc98e5273..9fe879f46 100644 --- a/crates/fj-kernel/src/operations/insert.rs +++ b/crates/fj-kernel/src/operations/insert.rs @@ -12,15 +12,23 @@ use crate::{ /// This is the only primitive operation that is directly understood by /// `Service`. All other operations are built on top of it. pub trait Insert: Sized { + /// The type of `Self`, once it has been inserted + /// + /// Usually this is just `Handle`, but there are some more complex + /// cases where this type needs to be customized. + type Inserted; + /// Insert the object into its respective store - fn insert(self, services: &mut Services) -> Handle; + fn insert(self, services: &mut Services) -> Self::Inserted; } macro_rules! impl_insert { ($($ty:ty, $store:ident;)*) => { $( impl Insert for $ty { - fn insert(self, services: &mut Services) -> Handle { + type Inserted = Handle; + + fn insert(self, services: &mut Services) -> Self::Inserted { let handle = services.objects.$store.reserve(); let object = (handle.clone(), self).into(); services.insert_object(object);