use std::marker::PhantomData;
use tl_interface::IInterface;
pub trait HList<I> {
type Interface;
}
pub struct TlN_<I>(PhantomData::<I>);
pub struct TlC_<I,
Item: IInterface<I>,
Tail: HList<I>>
(PhantomData::<(I, Item, Tail)>);
impl<I> HList<I> for TlN_<I> {
type Interface = I;
}
impl<I, Item, Tail> HList<I> for TlC_<I, Item, Tail>
where
Item: IInterface<I>,
Tail: HList<I>
{
type Interface = I;
}
pub struct CNI32_;
pub struct CCI32_<const HEAD: i32, Tail>(Tail);
pub trait I32List {
}
impl I32List for CNI32_ {}
impl<const C: i32, Tail> I32List for CCI32_<C, Tail> {}
#[macro_export]
macro_rules! tl_list {
($iface:ty) => {
tl_list_lib::TlN_<$iface>
};
($iface:ty, $head:ty $(, $tail:ty)*) => {
tl_list_lib::TlC_<$iface, $head, tl_list_lib::tl_list!($iface $(, $tail)*)>
};
}
#[macro_export]
macro_rules! tl_i32_list {
() => {
tl_list_lib::CNI32_
};
($head:literal $(, $tail:tt)*) => {
tl_list_lib::CCI32_<$head, tl_list_lib::tl_i32_list!($($tail),*)>
};
}