#![allow(missing_docs, dead_code)]
use static_assertions::{assert_impl_one, assert_not_impl_any};
use variadics_please::all_tuples;
trait Foo {}
macro_rules! foo {
($($t: ident),* $(,)?) => {
impl<$($t),*> Foo for ($($t,)*) {}
};
}
all_tuples!(foo, 0, 2, T);
all_tuples!(foo, 4, 5, T);
trait Bar {}
macro_rules! bar {
($(($t1: ident, $t2: ident)),* $(,)?) => {
impl<$($t1,)* $($t2),*> Bar for ($(($t1, $t2),)*) {}
};
}
all_tuples!(bar, 0, 2, T, U);
all_tuples!(bar, 4, 5, T, U);
#[test]
fn basic_test() {
assert_impl_one!((): Foo);
assert_impl_one!(((),): Foo);
assert_impl_one!(((), ()): Foo);
assert_not_impl_any!(((), (), ()): Foo);
assert_impl_one!(((), (), (), ()): Foo);
assert_impl_one!(((), (), (), (), ()): Foo);
assert_not_impl_any!(((), (), (), (), (), ()): Foo);
assert_impl_one!((): Bar);
assert_impl_one!((((), ()),): Bar);
assert_impl_one!((((),()), ((),())): Bar);
assert_not_impl_any!((((),()), ((),()), ((),())): Bar);
assert_impl_one!((((),()), ((),()), ((),()), ((),())): Bar);
assert_impl_one!((((),()), ((),()), ((),()), ((),()), ((),())): Bar);
assert_not_impl_any!((((),()), ((),()), ((),()), ((),()), ((),()), ((),())): Bar);
}