Trait frunk_core::hlist::HList
[−]
[src]
pub trait HList: Sized { fn length(&self) -> u32; fn prepend<H>(self, h: H) -> HCons<H, Self> { ... } }
Typeclass for HList-y behaviour
An HList is a heterogeneous list, one that is statically typed at compile time. In simple terms, it is just an arbitrarily-nested Tuple2.
Required Methods
fn length(&self) -> u32
Returns the length of a given HList
let h = hlist![1, "hi"]; assert_eq!(h.length(), 2);
Provided Methods
fn prepend<H>(self, h: H) -> HCons<H, Self>
Prepends an item to the current HList
let h1 = hlist![1, "hi"]; let h2 = h1.prepend(true); let (a, (b, c)) = h2.into_tuple2(); assert_eq!(a, true); assert_eq!(b, 1); assert_eq!(c, "hi");