pub trait TList: Sealed + TListImpl {
type Concat<Rhs: TList>: TList;
type Reverse: TList;
type IsEmpty: Bit;
type Len: UnsignedExt;
const IS_EMPTY: bool;
const LEN: usize;
}
Expand description
Type-level lists.
This trait is a “type-level enum”. TList, TNil and TCons are the type-level equivalent of the following value-level enum:
ⓘ
pub enum List<H, T> {
Nil,
Cons(H, T),
}
This trait can be considered a ‘marker’ trait: It has no methods to be called at runtime. It only has some GATs.
Rather than calling these GATs directly, it is recommended to instead use their type aliases, as calling those is less verbose:
use tlist::*;
// This is possible...
type Fine = <TList![u8, u16] as TList>::Concat<TList![u32, u64]>;
// But this is more readable:
type Nice = Concat<TList![u8, u16], TList![u32, u64]>;
static_assertions::assert_type_eq_all!(Fine, Nice);