[][src]Trait lhlist::Len

pub trait Len {
    const LEN: usize;
    fn len(&self) -> usize { ... }
}

Provides the length of a cons-list.

Since cons-list types are statically defined, this length is known at compile-time.

Example

use lhlist::{Cons, Len, Nil};

type MyList = Cons<usize, Cons<&'static str, Cons<f32, Nil>>>;
assert_eq!(MyList::LEN, 3usize);

let list: MyList = cons![8, "Hello!", 4.5];
assert_eq!(list.len(), 3usize);

Associated Constants

const LEN: usize

The length of this list

Loading content...

Provided methods

fn len(&self) -> usize

Returns the length of this list

Loading content...

Implementors

impl Len for Nil[src]

fn len(&self) -> usize[src]

impl<H, T> Len for Cons<H, T> where
    T: Len
[src]

fn len(&self) -> usize[src]

Loading content...