list::list! [-]  [+] [src]

macro_rules! list[
    ()                       => (Nil);
    ($x:expr)                => (Cons($x, box Nil));
    ($x:expr, $($xs:expr),+) => (Cons($x, box list!($($xs),+)));
];

Create a list::List containing the arguments.

let nil: List<int> = Nil;
assert_eq!(list![],         nil);
assert_eq!(list![1i],       Cons(1i, box Nil));
assert_eq!(list![1i, 2],    Cons(1i, box Cons(2i, box Nil)));
assert_eq!(list![1i, 2, 3], Cons(1i, box Cons(2i, box Cons(3, box Nil))));