mirror of https://github.com/hannobraun/Fornjot
Add infrastructure for tracking object insertion
This commit is contained in:
parent
da5bd11057
commit
8767c789b8
|
@ -50,3 +50,30 @@ impl_insert!(
|
||||||
Surface, surfaces;
|
Surface, surfaces;
|
||||||
Vertex, vertices;
|
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<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Indicate that an object has been inserted
|
||||||
|
///
|
||||||
|
/// See [`IsInserted`].
|
||||||
|
pub struct IsInsertedYes;
|
||||||
|
|
||||||
|
impl IsInserted for IsInsertedYes {
|
||||||
|
type T<T> = Handle<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Indicate that an object has not been inserted
|
||||||
|
///
|
||||||
|
/// See [`IsInserted`].
|
||||||
|
pub struct IsInsertedNo;
|
||||||
|
|
||||||
|
impl IsInserted for IsInsertedNo {
|
||||||
|
type T<T> = T;
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub use self::{
|
||||||
BuildCycle, BuildFace, BuildHalfEdge, BuildShell, BuildSurface,
|
BuildCycle, BuildFace, BuildHalfEdge, BuildShell, BuildSurface,
|
||||||
Polygon, Tetrahedron,
|
Polygon, Tetrahedron,
|
||||||
},
|
},
|
||||||
insert::Insert,
|
insert::{Insert, IsInserted, IsInsertedNo, IsInsertedYes},
|
||||||
join::JoinCycle,
|
join::JoinCycle,
|
||||||
update::{UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateShell},
|
update::{UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateShell},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue