diff --git a/honeycomb-core/src/cells/collections.rs b/honeycomb-core/src/cells/collections.rs index 34d5208d..0510cf16 100644 --- a/honeycomb-core/src/cells/collections.rs +++ b/honeycomb-core/src/cells/collections.rs @@ -6,7 +6,7 @@ // ------ IMPORTS -use crate::{CMap2, CoordsFloat, EdgeIdentifier, FaceIdentifier, VertexIdentifier}; +use crate::{CMap2, CoordsFloat}; // ------ CONTENT @@ -25,6 +25,13 @@ macro_rules! collection_constructor { // --- vertices +/// Type definition for vertex identifiers +/// +/// This is used for better control over memory usage and ID encoding. +pub type VertexIdentifier = u32; + +pub const NULL_VERTEX_ID: VertexIdentifier = 0; + pub struct VertexCollection<'a, T: CoordsFloat> { lifetime_indicator: std::marker::PhantomData<&'a CMap2>, pub identifiers: Vec, @@ -34,6 +41,13 @@ collection_constructor!(VertexCollection, VertexIdentifier); // --- edges +/// Type definition for edge identifiers +/// +/// This is used for better control over memory usage and ID encoding. +pub type EdgeIdentifier = u32; + +pub const NULL_EDGE_ID: EdgeIdentifier = 0; + pub struct EdgeCollection<'a, T: CoordsFloat> { lifetime_indicator: std::marker::PhantomData<&'a CMap2>, pub identifiers: Vec, @@ -43,9 +57,25 @@ collection_constructor!(EdgeCollection, EdgeIdentifier); // --- faces +/// Type definition for face identifiers +/// +/// This is used for better control over memory usage and ID encoding. +pub type FaceIdentifier = u32; + +pub const NULL_FACE_ID: FaceIdentifier = 0; + pub struct FaceCollection<'a, T: CoordsFloat> { lifetime_indicator: std::marker::PhantomData<&'a CMap2>, pub identifiers: Vec, } collection_constructor!(FaceCollection, FaceIdentifier); + +// --- volumes + +/// Type definition for volume identifiers +/// +/// This is used for better control over memory usage and ID encoding. +pub type VolumeIdentifier = u32; + +pub const NULL_VOLUME_ID: VolumeIdentifier = 0; diff --git a/honeycomb-core/src/cells/identifiers.rs b/honeycomb-core/src/cells/identifiers.rs deleted file mode 100644 index 335e7ba0..00000000 --- a/honeycomb-core/src/cells/identifiers.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! Custom identifier type aliases -//! -//! This module is most likely temporary as ID types will be moved to where cell-specific -//! attributes are defined. - -// ------ CONTENT - -/// Type definition for dart identifiers -/// -/// This is used for better control over memory usage and ID encoding. -pub type DartIdentifier = u32; - -pub const NULL_DART_ID: DartIdentifier = 0; - -/// Type definition for vertex identifiers -/// -/// This is used for better control over memory usage and ID encoding. -pub type VertexIdentifier = u32; - -pub const NULL_VERTEX_ID: DartIdentifier = 0; - -/// Type definition for edge identifiers -/// -/// This is used for better control over memory usage and ID encoding. -pub type EdgeIdentifier = u32; - -pub const NULL_EDGE_ID: DartIdentifier = 0; - -/// Type definition for face identifiers -/// -/// This is used for better control over memory usage and ID encoding. -pub type FaceIdentifier = u32; - -pub const NULL_FACE_ID: DartIdentifier = 0; - -/// Type definition for volume identifiers -/// -/// This is used for better control over memory usage and ID encoding. -pub type VolumeIdentifier = u32; - -pub const NULL_VOLUME_ID: DartIdentifier = 0; diff --git a/honeycomb-core/src/cells/mod.rs b/honeycomb-core/src/cells/mod.rs index 2a46b9d9..9eef6cc9 100644 --- a/honeycomb-core/src/cells/mod.rs +++ b/honeycomb-core/src/cells/mod.rs @@ -5,5 +5,13 @@ // ------ MODULE DECLARATIONS pub mod collections; -pub mod identifiers; pub mod orbits; + +// ------ CONTENT + +/// Type definition for dart identifiers +/// +/// This is used for better control over memory usage and ID encoding. +pub type DartIdentifier = u32; + +pub const NULL_DART_ID: DartIdentifier = 0; diff --git a/honeycomb-core/src/lib.rs b/honeycomb-core/src/lib.rs index 5dd8dd3a..f88b69d9 100644 --- a/honeycomb-core/src/lib.rs +++ b/honeycomb-core/src/lib.rs @@ -31,12 +31,13 @@ pub use attributes::{ traits::{AttributeBind, AttributeUpdate}, }; pub use cells::{ - collections::{EdgeCollection, FaceCollection, VertexCollection}, - identifiers::{ - DartIdentifier, EdgeIdentifier, FaceIdentifier, VertexIdentifier, VolumeIdentifier, - NULL_DART_ID, NULL_EDGE_ID, NULL_FACE_ID, NULL_VERTEX_ID, NULL_VOLUME_ID, + collections::{ + EdgeCollection, EdgeIdentifier, FaceCollection, FaceIdentifier, VertexCollection, + VertexIdentifier, VolumeIdentifier, NULL_EDGE_ID, NULL_FACE_ID, NULL_VERTEX_ID, + NULL_VOLUME_ID, }, orbits::{Orbit2, OrbitPolicy}, + DartIdentifier, NULL_DART_ID, }; pub use spatial_repr::{ coords::{Coords2, CoordsError},