From 944b697ed3bc7cd347977f381629353db7b1fdee Mon Sep 17 00:00:00 2001
From: imrn99 <95699343+imrn99@users.noreply.github.com>
Date: Mon, 25 Nov 2024 10:12:55 +0100
Subject: [PATCH] fix match arms
---
honeycomb-core/src/attributes/manager.rs | 64 ++++++++++++++++--------
1 file changed, 42 insertions(+), 22 deletions(-)
diff --git a/honeycomb-core/src/attributes/manager.rs b/honeycomb-core/src/attributes/manager.rs
index 21a70e91..1b44a9c0 100644
--- a/honeycomb-core/src/attributes/manager.rs
+++ b/honeycomb-core/src/attributes/manager.rs
@@ -21,9 +21,11 @@ use std::{any::TypeId, collections::HashMap};
macro_rules! get_storage {
($slf: ident, $id: ident) => {
let probably_storage = match A::BIND_POLICY {
- OrbitPolicy::Vertex => $slf.vertices.get(&TypeId::of::()),
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
+ $slf.vertices.get(&TypeId::of::())
+ }
OrbitPolicy::Edge => $slf.edges.get(&TypeId::of::()),
- OrbitPolicy::Face => $slf.faces.get(&TypeId::of::()),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => $slf.faces.get(&TypeId::of::()),
OrbitPolicy::Custom(_) => $slf.others.get(&TypeId::of::()),
};
let $id = probably_storage
@@ -35,9 +37,11 @@ macro_rules! get_storage {
macro_rules! get_storage_mut {
($slf: ident, $id: ident) => {
let probably_storage = match A::BIND_POLICY {
- OrbitPolicy::Vertex => $slf.vertices.get_mut(&TypeId::of::()),
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
+ $slf.vertices.get_mut(&TypeId::of::())
+ }
OrbitPolicy::Edge => $slf.edges.get_mut(&TypeId::of::()),
- OrbitPolicy::Face => $slf.faces.get_mut(&TypeId::of::()),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => $slf.faces.get_mut(&TypeId::of::()),
OrbitPolicy::Custom(_) => $slf.others.get_mut(&TypeId::of::()),
};
let $id = probably_storage
@@ -162,9 +166,13 @@ impl AttrStorageManager {
let typeid = TypeId::of::();
let new_storage = ::StorageType::new(size);
if match A::BIND_POLICY {
- OrbitPolicy::Vertex => self.vertices.insert(typeid, Box::new(new_storage)),
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
+ self.vertices.insert(typeid, Box::new(new_storage))
+ }
OrbitPolicy::Edge => self.edges.insert(typeid, Box::new(new_storage)),
- OrbitPolicy::Face => self.faces.insert(typeid, Box::new(new_storage)),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
+ self.faces.insert(typeid, Box::new(new_storage))
+ }
OrbitPolicy::Custom(_) => self.others.insert(typeid, Box::new(new_storage)),
}
.is_some()
@@ -212,9 +220,9 @@ impl AttrStorageManager {
#[must_use = "unused getter result - please remove this method call"]
pub fn get_storage(&self) -> Option<&::StorageType> {
let probably_storage = match A::BIND_POLICY {
- OrbitPolicy::Vertex => &self.vertices[&TypeId::of::()],
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => &self.vertices[&TypeId::of::()],
OrbitPolicy::Edge => &self.edges[&TypeId::of::()],
- OrbitPolicy::Face => &self.faces[&TypeId::of::()],
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => &self.faces[&TypeId::of::()],
OrbitPolicy::Custom(_) => &self.others[&TypeId::of::()],
};
probably_storage.downcast_ref::<::StorageType>()
@@ -231,9 +239,11 @@ impl AttrStorageManager {
pub fn remove_storage(&mut self) {
// we could return it ?
let _ = match A::BIND_POLICY {
- OrbitPolicy::Vertex => &self.vertices.remove(&TypeId::of::()),
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
+ &self.vertices.remove(&TypeId::of::())
+ }
OrbitPolicy::Edge => &self.edges.remove(&TypeId::of::()),
- OrbitPolicy::Face => &self.faces.remove(&TypeId::of::()),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => &self.faces.remove(&TypeId::of::()),
OrbitPolicy::Custom(_) => &self.others.remove(&TypeId::of::()),
};
}
@@ -256,9 +266,13 @@ impl AttrStorageManager {
id_in_rhs: DartIdType,
) {
match orbit_policy {
- OrbitPolicy::Vertex => self.force_merge_vertex_attributes(id_out, id_in_lhs, id_in_rhs),
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
+ self.force_merge_vertex_attributes(id_out, id_in_lhs, id_in_rhs)
+ }
OrbitPolicy::Edge => self.force_merge_edge_attributes(id_out, id_in_lhs, id_in_rhs),
- OrbitPolicy::Face => self.force_merge_face_attributes(id_out, id_in_lhs, id_in_rhs),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
+ self.force_merge_face_attributes(id_out, id_in_lhs, id_in_rhs)
+ }
OrbitPolicy::Custom(_) => unimplemented!(),
}
}
@@ -335,11 +349,13 @@ impl AttrStorageManager {
id_in_rhs: DartIdType,
) -> StmResult<()> {
match orbit_policy {
- OrbitPolicy::Vertex => {
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
self.merge_vertex_attributes(trans, id_out, id_in_lhs, id_in_rhs)
}
OrbitPolicy::Edge => self.merge_edge_attributes(trans, id_out, id_in_lhs, id_in_rhs),
- OrbitPolicy::Face => self.merge_face_attributes(trans, id_out, id_in_lhs, id_in_rhs),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
+ self.merge_face_attributes(trans, id_out, id_in_lhs, id_in_rhs)
+ }
OrbitPolicy::Custom(_) => unimplemented!(),
}
}
@@ -448,13 +464,13 @@ impl AttrStorageManager {
id_in_rhs: DartIdType,
) -> CMapResult<()> {
match orbit_policy {
- OrbitPolicy::Vertex => {
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
self.try_merge_vertex_attributes(trans, id_out, id_in_lhs, id_in_rhs)
}
OrbitPolicy::Edge => {
self.try_merge_edge_attributes(trans, id_out, id_in_lhs, id_in_rhs)
}
- OrbitPolicy::Face => {
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
self.try_merge_face_attributes(trans, id_out, id_in_lhs, id_in_rhs)
}
OrbitPolicy::Custom(_) => unimplemented!(),
@@ -637,11 +653,13 @@ impl AttrStorageManager {
id_in: DartIdType,
) {
match orbit_policy {
- OrbitPolicy::Vertex => {
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
self.force_split_vertex_attributes(id_out_lhs, id_out_rhs, id_in);
}
OrbitPolicy::Edge => self.force_split_edge_attributes(id_out_lhs, id_out_rhs, id_in),
- OrbitPolicy::Face => self.force_split_face_attributes(id_out_lhs, id_out_rhs, id_in),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
+ self.force_split_face_attributes(id_out_lhs, id_out_rhs, id_in)
+ }
OrbitPolicy::Custom(_) => unimplemented!(),
}
}
@@ -721,11 +739,13 @@ impl AttrStorageManager {
id_in: DartIdType,
) -> StmResult<()> {
match orbit_policy {
- OrbitPolicy::Vertex => {
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
self.split_vertex_attributes(trans, id_out_lhs, id_out_rhs, id_in)
}
OrbitPolicy::Edge => self.split_edge_attributes(trans, id_out_lhs, id_out_rhs, id_in),
- OrbitPolicy::Face => self.split_face_attributes(trans, id_out_lhs, id_out_rhs, id_in),
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
+ self.split_face_attributes(trans, id_out_lhs, id_out_rhs, id_in)
+ }
OrbitPolicy::Custom(_) => unimplemented!(),
}
}
@@ -835,13 +855,13 @@ impl AttrStorageManager {
id_in: DartIdType,
) -> CMapResult<()> {
match orbit_policy {
- OrbitPolicy::Vertex => {
+ OrbitPolicy::Vertex | OrbitPolicy::VertexLinear => {
self.try_split_vertex_attributes(trans, id_out_lhs, id_out_rhs, id_in)
}
OrbitPolicy::Edge => {
self.try_split_edge_attributes(trans, id_out_lhs, id_out_rhs, id_in)
}
- OrbitPolicy::Face => {
+ OrbitPolicy::Face | OrbitPolicy::FaceLinear => {
self.try_split_face_attributes(trans, id_out_lhs, id_out_rhs, id_in)
}
OrbitPolicy::Custom(_) => unimplemented!(),