summaryrefslogtreecommitdiff
path: root/ecs/src/query/term.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-05-21 17:55:20 +0200
committerHampusM <hampus@hampusmat.com>2026-05-21 17:55:20 +0200
commit8022e8998290b067b8aa0cb9cba8ba410826bdab (patch)
tree7171e79ce530e03079046ee8fd12167160c45480 /ecs/src/query/term.rs
parent412cee02c252f91bcf0b70a3f5cc5fca6d2b4c62 (diff)
chore: rename ecs* crates to engine-ecs*
Diffstat (limited to 'ecs/src/query/term.rs')
-rw-r--r--ecs/src/query/term.rs116
1 files changed, 0 insertions, 116 deletions
diff --git a/ecs/src/query/term.rs b/ecs/src/query/term.rs
deleted file mode 100644
index 0683918..0000000
--- a/ecs/src/query/term.rs
+++ /dev/null
@@ -1,116 +0,0 @@
-use std::any::type_name;
-use std::marker::PhantomData;
-
-use crate::component::{
- Component,
- Handle as ComponentHandle,
- HandleMut as ComponentHandleMut,
-};
-use crate::query::{
- TermWithField,
- TermWithoutField,
- TermsBuilder,
- TermsBuilderInterface,
-};
-use crate::uid::With as WithUid;
-
-pub struct With<WithUidT>
-where
- WithUidT: WithUid,
-{
- _pd: PhantomData<WithUidT>,
-}
-
-impl<WithUidT> TermWithoutField for With<WithUidT>
-where
- WithUidT: WithUid,
-{
- fn apply_to_terms_builder<const MAX_TERM_CNT: usize>(
- terms_builder: &mut TermsBuilder<MAX_TERM_CNT>,
- )
- {
- terms_builder.with::<WithUidT>();
- }
-}
-
-pub struct Without<WithUidT>
-where
- WithUidT: WithUid,
-{
- _pd: PhantomData<WithUidT>,
-}
-
-impl<WithUidT> TermWithoutField for Without<WithUidT>
-where
- WithUidT: WithUid,
-{
- fn apply_to_terms_builder<const MAX_TERM_CNT: usize>(
- terms_builder: &mut TermsBuilder<MAX_TERM_CNT>,
- )
- {
- terms_builder.without::<WithUidT>();
- }
-}
-
-impl<ComponentT: Component> TermWithField for Option<&ComponentT>
-{
- type Field<'a> = Option<ComponentHandle<'a, ComponentT>>;
-
- fn apply_to_terms_builder<const MAX_TERM_CNT: usize>(
- _terms_builder: &mut TermsBuilder<MAX_TERM_CNT>,
- )
- {
- }
-
- fn get_field<'world>(
- entity_handle: &crate::entity::Handle<'world>,
- _world: &'world crate::World,
- ) -> Self::Field<'world>
- {
- Some(
- ComponentHandle::<'world, ComponentT>::from_entity_component_ref(
- &entity_handle
- .get_matching_components(ComponentT::id())
- .next()?,
- )
- .unwrap_or_else(|err| {
- panic!(
- "Creating handle to component {} failed: {err}",
- type_name::<ComponentT>()
- );
- }),
- )
- }
-}
-
-impl<ComponentT: Component> TermWithField for Option<&mut ComponentT>
-{
- type Field<'a> = Option<ComponentHandleMut<'a, ComponentT>>;
-
- fn apply_to_terms_builder<const MAX_TERM_CNT: usize>(
- _terms_builder: &mut TermsBuilder<MAX_TERM_CNT>,
- )
- {
- }
-
- fn get_field<'world>(
- entity_handle: &crate::entity::Handle<'world>,
- world: &'world crate::World,
- ) -> Self::Field<'world>
- {
- Some(
- ComponentHandleMut::<'world, ComponentT>::from_entity_component_ref(
- &entity_handle
- .get_matching_components(ComponentT::id())
- .next()?,
- world,
- )
- .unwrap_or_else(|err| {
- panic!(
- "Creating handle to component {} failed: {err}",
- type_name::<ComponentT>()
- );
- }),
- )
- }
-}