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.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs
index f5aa0d1..b2ecf80 100644
--- a/ecs/src/component.rs
+++ b/ecs/src/component.rs
@@ -167,7 +167,9 @@ pub trait Sequence
/// The number of components in this component sequence.
const COUNT: usize;
- fn into_vec(self) -> Vec<Box<dyn Component>>;
+ type Array: Array<Box<dyn Component>>;
+
+ fn into_array(self) -> Self::Array;
fn metadata() -> impl Array<Metadata>;
@@ -277,9 +279,11 @@ macro_rules! inner {
{
const COUNT: usize = $c + 1;
- fn into_vec(self) -> Vec<Box<dyn Component>>
+ type Array = [Box<dyn Component>; $c + 1];
+
+ fn into_array(self) -> Self::Array
{
- Vec::from_iter([#(Box::new(self.I) as Box<dyn Component>,)*])
+ [#(Box::new(self.I) as Box<dyn Component>,)*]
}
fn metadata() -> impl Array<Metadata>
@@ -356,11 +360,13 @@ seq!(C in 0..=16 {
impl Sequence for ()
{
+ type Array = [Box<dyn Component>; 0];
+
const COUNT: usize = 0;
- fn into_vec(self) -> Vec<Box<dyn Component>>
+ fn into_array(self) -> Self::Array
{
- Vec::new()
+ []
}
fn metadata() -> impl Array<Metadata>