Macro leetcode::list

source ·
macro_rules! list {
    () => { ... };
    ($elem:expr; $n:expr) => { ... };
    ($($x:expr),+ $(,)?) => { ... };
}
Expand description

Generate a linked list from a vec-like syntax.

For example:

#[macro_use] extern crate leetcode;
use leetcode::ListNode;
let head: Option<Box<ListNode>> = list![1,2,3,4];
// head:
// 1 -> 2 -> 3 -> 4 -> None

let head = list![1i32; 5];
// head:
// 1 -> 1 -> 1 -> 1 -> 1 -> None