Crate sorted_hlist

Source
Expand description

A minimal, no-std library for type-level heterogeneous lists (HLists) and their compile-time intersection.

You can build an HList via the mk_hlist! macro, mark lists as SortedHList when their element types are in non-decreasing order (via typenum::Cmp), and compute the intersection of two sorted lists using the Intersect trait (which under the hood uses IntersectUnchecked).

Macros§

mk_hlist
Build a type-level HList from a comma-separated list of types.

Structs§

HCons
A non-empty type-level list, with head of type H and tail T.
HNil
The empty type-level list.

Traits§

HList
Marker trait for all HLists.
Intersect
Checked intersection of two sorted HLists.
IntersectByOrder
Internal dispatch by comparing the heads of two lists. Chooses one of three branches (Less, Equal, Greater) and recurses accordingly.
IntersectUnchecked
Compute the intersection of two arbitrary HLists, with no sortedness requirements. Yields an HList of the common elements (in the order of the left list).
LeOrEq
Internal helper trait indicating a type-level “leq” relationship for Cmp.
NonEmptyHList
Marker trait for non-empty HLists (i.e. HCons<_, _>).
SortedHList
Marker trait for lists whose element types are in non-decreasing order.