HList

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.

Required Methods§

Source

fn len(&self) -> usize

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);

Provided Methods§

Source

fn is_empty(&self) -> bool

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());

Implementors§

Source§

impl HList for Nil

Source§

impl<Head, Tail> HList for Cons<Head, Tail>
where Tail: HList + ?Sized,