diff --git a/crates/fj-kernel/src/operations/insert.rs b/crates/fj-kernel/src/operations/insert.rs index 9fe879f46..f76b3d9d6 100644 --- a/crates/fj-kernel/src/operations/insert.rs +++ b/crates/fj-kernel/src/operations/insert.rs @@ -50,3 +50,30 @@ impl_insert!( Surface, surfaces; Vertex, vertices; ); + +/// Indicate whether an object has been inserted +/// +/// Intended to be used as a type parameter bound for structs that need to track +/// whether their contents have been inserted or not. +pub trait IsInserted { + /// The type of the object for which the insertion status is tracked + type T; +} + +/// Indicate that an object has been inserted +/// +/// See [`IsInserted`]. +pub struct IsInsertedYes; + +impl IsInserted for IsInsertedYes { + type T = Handle; +} + +/// Indicate that an object has not been inserted +/// +/// See [`IsInserted`]. +pub struct IsInsertedNo; + +impl IsInserted for IsInsertedNo { + type T = T; +} diff --git a/crates/fj-kernel/src/operations/mod.rs b/crates/fj-kernel/src/operations/mod.rs index 07d818c66..de4ebc596 100644 --- a/crates/fj-kernel/src/operations/mod.rs +++ b/crates/fj-kernel/src/operations/mod.rs @@ -10,7 +10,7 @@ pub use self::{ BuildCycle, BuildFace, BuildHalfEdge, BuildShell, BuildSurface, Polygon, Tetrahedron, }, - insert::Insert, + insert::{Insert, IsInserted, IsInsertedNo, IsInsertedYes}, join::JoinCycle, update::{UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateShell}, };