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
use super::Borrows;
use crate::{IntoAccess, Subset};
pub use smallvec::smallvec;
pub trait ComponentBorrow {
fn borrows() -> Borrows;
fn has<U: IntoAccess>() -> bool;
}
macro_rules! tuple_impl {
($($name: ident), *) => {
impl<$($name: IntoAccess,)*> ComponentBorrow for ($($name,) *) {
fn borrows() -> Borrows {
smallvec![$($name::access()), *]
}
fn has<U: IntoAccess>() -> bool {
$(($name::compatible::<U>())) || *
}
}
impl<$($name: IntoAccess,)*> Subset for ($($name,) *) {
fn is_subset<U: ComponentBorrow>() -> bool {
$((U::has::<$name>())) && *
}
}
};
}
impl_for_tuples!(tuple_impl);