diff --git a/src/geometry/geometry.rs b/src/geometry/geometry.rs
index 8e14a91..bec0b2d 100644
--- a/src/geometry/geometry.rs
+++ b/src/geometry/geometry.rs
@@ -73,6 +73,15 @@ pub enum GenericNode
{
Compound(C),
}
+impl GetPetgraphIndex for GenericNode {
+ fn petgraph_index(&self) -> NodeIndex {
+ match self {
+ Self::Primitive(x) => x.petgraph_index(),
+ Self::Compound(x) => x.petgraph_index(),
+ }
+ }
+}
+
pub trait AccessDotWeight: GetSetPos + GetWidth + Copy {}
impl AccessDotWeight for T {}
diff --git a/src/graph.rs b/src/graph.rs
index d87ae9d..99b41c2 100644
--- a/src/graph.rs
+++ b/src/graph.rs
@@ -18,6 +18,13 @@ pub trait GetPetgraphIndex {
fn petgraph_index(&self) -> NodeIndex;
}
+impl GetPetgraphIndex for NodeIndex {
+ #[inline(always)]
+ fn petgraph_index(&self) -> NodeIndex {
+ *self
+ }
+}
+
// unfortunately, as we don't want any restrictions on `W`,
// we have to implement many traits ourselves, instead of using derive macros.
#[derive(Deserialize, Serialize)]
@@ -40,7 +47,7 @@ impl GenericIndex {
}
impl core::clone::Clone for GenericIndex {
- #[inline]
+ #[inline(always)]
fn clone(&self) -> Self {
*self
}