blob: 89e0cc424c5a897a286ac53b0d0a2f08b6570235 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
use seq_macro::seq;
use crate::component::{IntoParts, Parts};
use crate::util::Array;
pub trait Bundle
{
type PartsArray: Array<Parts>;
fn cnt(&self) -> usize;
fn into_parts_array(self) -> Self::PartsArray;
}
macro_rules! gen_tuple_impls {
($c: tt) => {
seq!(I in 0..$c {
impl<#(IntoCompParts~I: IntoParts,)*> Bundle for (#(IntoCompParts~I,)*)
{
type PartsArray = [Parts; $c];
fn cnt(&self) -> usize
{
$c
}
fn into_parts_array(self) -> Self::PartsArray
{
[#({
self.I.into_parts()
},)*]
}
}
});
};
}
seq!(C in 0..17 {
gen_tuple_impls!(C);
});
|