summaryrefslogtreecommitdiff
path: root/ecs/src/component.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-12-21 14:43:53 +0100
committerHampusM <hampus@hampusmat.com>2024-12-21 14:44:56 +0100
commit5feeaf154a8b729873c729b4488f28536cf4ae24 (patch)
tree044a4ebb94f11af6b44ccc411eca9ee55f92bcfc /ecs/src/component.rs
parent36bfd4159cb1bd8b3d47a834824465728dfb5bd8 (diff)
feat(ecs): add support for entities without components
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r--ecs/src/component.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs
index 85c556f..1fde5b4 100644
--- a/ecs/src/component.rs
+++ b/ecs/src/component.rs
@@ -351,3 +351,51 @@ macro_rules! inner {
seq!(C in 0..=64 {
inner!(C);
});
+
+impl Sequence for ()
+{
+ type MutRefs<'component> = ();
+ type Refs<'component> = ();
+
+ fn into_vec(self) -> Vec<Box<dyn Component>>
+ {
+ Vec::new()
+ }
+
+ fn metadata() -> Vec<Metadata>
+ {
+ Vec::new()
+ }
+
+ fn added_event_ids() -> Vec<Uid>
+ {
+ Vec::new()
+ }
+
+ fn removed_event_ids() -> Vec<Uid>
+ {
+ Vec::new()
+ }
+
+ #[inline]
+ fn from_components_mut<'component>(
+ _components: &'component [EntityComponent],
+ _component_index_lookup: impl Fn(Uid) -> Option<usize>,
+ _world: &'component World,
+ _lock_component: fn(&EntityComponent) -> WriteGuard<'_, Box<dyn Component>>,
+ ) -> Self::MutRefs<'component>
+ {
+ ()
+ }
+
+ #[inline]
+ fn from_components<'component>(
+ _components: &'component [EntityComponent],
+ _component_index_lookup: impl Fn(Uid) -> Option<usize>,
+ _world: &'component World,
+ _lock_component: fn(&EntityComponent) -> ReadGuard<'_, Box<dyn Component>>,
+ ) -> Self::Refs<'component>
+ {
+ ()
+ }
+}