summaryrefslogtreecommitdiff
path: root/ecs/src/util.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-01-02 17:02:25 +0100
committerHampusM <hampus@hampusmat.com>2025-01-02 17:02:25 +0100
commit85ed89df486858984f0936086205efc23fd32d24 (patch)
treef0480c745b3980e0767ed79177d87188f8129514 /ecs/src/util.rs
parent1f6685aa570eadc70342bd1c62f5f9ff451afcb2 (diff)
refactor(ecs): make component::Sequence return metadata as array
Diffstat (limited to 'ecs/src/util.rs')
-rw-r--r--ecs/src/util.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/ecs/src/util.rs b/ecs/src/util.rs
index 0344e89..4ba8597 100644
--- a/ecs/src/util.rs
+++ b/ecs/src/util.rs
@@ -1,5 +1,18 @@
use std::ops::BitAnd;
+pub trait Array<Item>:
+ AsRef<[Item]>
+ + AsMut<[Item]>
+ + IntoIterator<Item = Item>
+ + Sortable<Item = Item>
+ + sealed::Sealed
+{
+}
+
+impl<Item, const CNT: usize> Array<Item> for [Item; CNT] {}
+
+impl<Item, const CNT: usize> sealed::Sealed for [Item; CNT] {}
+
pub trait Sortable
{
type Item;
@@ -115,6 +128,11 @@ macro_rules! gen_mask_64 {
pub(crate) use gen_mask_64;
+mod sealed
+{
+ pub trait Sealed {}
+}
+
#[cfg(test)]
mod tests
{