Skip to main content

mesh_graph/elements/
mod.rs

1mod face;
2mod halfedge;
3mod vertex;
4
5pub use face::*;
6pub use halfedge::*;
7pub use vertex::*;
8
9use slotmap::{Key, KeyData, new_key_type};
10
11new_key_type! { pub struct VertexId; }
12new_key_type! { pub struct HalfedgeId; }
13new_key_type! { pub struct FaceId; }
14
15impl From<u128> for VertexId {
16    fn from(value: u128) -> Self {
17        KeyData::from_ffi(value as u64).into()
18    }
19}
20
21impl From<VertexId> for u128 {
22    fn from(value: VertexId) -> Self {
23        value.data().as_ffi() as u128
24    }
25}