Macro im::list [] [src]

macro_rules! list {
    () => { ... };
    ( $($x:expr),* ) => { ... };
}

Construct a list from a sequence of elements.

Examples

Here are some different ways of constructing a list of three numbers 1, 2 and 3:

assert_eq!(
  list![1, 2, 3],
  List::from_slice(&[1, 2, 3])
);

assert_eq!(
  list![1, 2, 3],
  cons(1, &cons(2, &cons(3, &List::empty())))
);