honeycomb_core/cmap/components/
identifiers.rsmacro_rules! impl_from_dartid {
($idty: ty) => {
impl From<DartId> for $idty {
fn from(dart_id: DartId) -> Self {
Self(dart_id.0.into())
}
}
};
}
macro_rules! impl_from_for_dartid {
($idty: ty) => {
impl From<$idty> for DartId {
fn from(id: $idty) -> Self {
Self(id.0.into())
}
}
};
}
pub type DartIdType = u32;
#[allow(unused)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct DartId(pub DartIdType);
pub const NULL_DART_ID: DartIdType = 0; impl_from_for_dartid!(VertexId);
impl_from_for_dartid!(EdgeId);
impl_from_for_dartid!(FaceId);
impl_from_for_dartid!(VolumeId);
pub type VertexIdType = u32;
#[allow(unused)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct VertexId(pub VertexIdType);
pub const NULL_VERTEX_ID: VertexIdType = 0; impl_from_dartid!(VertexId);
pub type EdgeIdType = u32;
#[allow(unused)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct EdgeId(pub EdgeIdType);
pub const NULL_EDGE_ID: EdgeIdType = 0; impl_from_dartid!(EdgeId);
pub type FaceIdType = u32;
#[allow(unused)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct FaceId(pub FaceIdType);
pub const NULL_FACE_ID: FaceIdType = 0; impl_from_dartid!(FaceId);
pub type VolumeIdType = u32;
#[allow(unused)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct VolumeId(pub VolumeIdType);
pub const NULL_VOLUME_ID: VolumeIdType = 0; impl_from_dartid!(VolumeId);