summaryrefslogtreecommitdiff
path: root/ecs/src/query/options.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-03-21 20:05:53 +0100
committerHampusM <hampus@hampusmat.com>2025-03-22 15:16:01 +0100
commitfe62665b1d62d36ee0839e6bf24e3841ea667da9 (patch)
tree0533941d2cbbe5bf0a1995a33f05bca37da949fd /ecs/src/query/options.rs
parent76e7e612e7b516bf52b508ae5bb367b1ddc3babc (diff)
refactor(ecs): replace query options with fieldless terms
Diffstat (limited to 'ecs/src/query/options.rs')
-rw-r--r--ecs/src/query/options.rs59
1 files changed, 0 insertions, 59 deletions
diff --git a/ecs/src/query/options.rs b/ecs/src/query/options.rs
deleted file mode 100644
index 6318359..0000000
--- a/ecs/src/query/options.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-use std::marker::PhantomData;
-
-use hashbrown::HashSet;
-
-use crate::component::Component;
-use crate::EntityComponent;
-
-/// Query options.
-pub trait Options
-{
- fn entity_filter(components: &[EntityComponent]) -> bool;
-}
-
-impl Options for ()
-{
- fn entity_filter(_components: &[EntityComponent]) -> bool
- {
- true
- }
-}
-
-pub struct With<ComponentT>
-where
- ComponentT: Component,
-{
- _pd: PhantomData<ComponentT>,
-}
-
-impl<ComponentT> Options for With<ComponentT>
-where
- ComponentT: Component,
-{
- fn entity_filter(components: &[EntityComponent]) -> bool
- {
- let ids_set = components
- .iter()
- .map(|component| component.id)
- .collect::<HashSet<_>>();
-
- ids_set.contains(&ComponentT::id())
- }
-}
-
-pub struct Not<OptionsT>
-where
- OptionsT: Options,
-{
- _pd: PhantomData<OptionsT>,
-}
-
-impl<OptionsT> Options for Not<OptionsT>
-where
- OptionsT: Options,
-{
- fn entity_filter(components: &[EntityComponent]) -> bool
- {
- !OptionsT::entity_filter(components)
- }
-}