Trait HList
Source pub trait HList: Sealed {
// Required method
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
Compile-time heterogenous list.
This trait is sealed and cannot be implemented outside of this crate.
It is implemented only for Cons and Nil structs.
Returns the length (count of elements) of the heterogenous list.
§Examples
use hlist2::{hlist, HList};
assert_eq!(hlist![].len(), 0);
assert_eq!(hlist![1].len(), 1);
assert_eq!(hlist![1, 2.0, true, "hello world"].len(), 4);
Checks if the heterogenous list is empty.
§Examples
use core::ops::Not;
use hlist2::{hlist, HList};
assert!(hlist![].is_empty());
assert!(hlist![1, 2.0, true].is_empty().not());