summaryrefslogtreecommitdiff
path: root/ecs/src/component.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r--ecs/src/component.rs75
1 files changed, 1 insertions, 74 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs
index 9257c41..265eb9e 100644
--- a/ecs/src/component.rs
+++ b/ecs/src/component.rs
@@ -13,7 +13,7 @@ use crate::system::Input as SystemInput;
use crate::type_name::TypeName;
use crate::uid::Uid;
use crate::util::Array;
-use crate::{EntityComponent, World};
+use crate::World;
pub mod local;
@@ -170,22 +170,6 @@ pub trait Sequence
fn removed_event_ids() -> Vec<Uid>;
}
-/// A sequence of references (immutable or mutable) to components.
-pub trait RefSequence
-{
- type Handles<'component>;
-
- type Metadata: Array<Metadata>;
-
- fn metadata() -> Self::Metadata;
-
- fn from_components<'component>(
- components: &'component [EntityComponent],
- component_index_lookup: impl Fn(Uid) -> Option<usize>,
- world: &'component World,
- ) -> Self::Handles<'component>;
-}
-
/// A mutable or immutable reference to a component.
pub trait Ref
{
@@ -317,44 +301,6 @@ macro_rules! inner {
]
}
}
-
- impl<#(CompRef~I: Ref,)*> RefSequence for (#(CompRef~I,)*)
- {
- type Handles<'component> = (#(CompRef~I::Handle<'component>,)*);
-
- type Metadata = [Metadata; $c + 1];
-
- fn metadata() -> Self::Metadata
- {
- [#(
- Metadata {
- id: CompRef~I::Component::id(),
- is_optional: CompRef~I::Component::is_optional(),
- },
- )*]
- }
-
- fn from_components<'component>(
- components: &'component [EntityComponent],
- component_index_lookup: impl Fn(Uid) -> Option<usize>,
- world: &'component World,
- ) -> Self::Handles<'component>
- {
- (#(
- CompRef~I::Handle::from_locked_optional_component(
- component_index_lookup(CompRef~I::Component::id())
- .and_then(|component_index| components.get(component_index))
- .map(|component| &component.component),
- world,
- ).unwrap_or_else(|err| {
- panic!(
- "Taking component {} lock failed: {err}",
- type_name::<CompRef~I::Component>()
- );
- }),
- )*)
- }
- }
});
};
}
@@ -390,25 +336,6 @@ impl Sequence for ()
}
}
-impl RefSequence for ()
-{
- type Handles<'component> = ();
- type Metadata = [Metadata; 0];
-
- fn metadata() -> Self::Metadata
- {
- []
- }
-
- fn from_components<'component>(
- _components: &'component [EntityComponent],
- _component_index_lookup: impl Fn(Uid) -> Option<usize>,
- _world: &'component World,
- ) -> Self::Handles<'component>
- {
- }
-}
-
pub trait Into
{
type Component;