macro_rules! make {
( let $name:ident = [ $head:expr $(,)? ] ) => { ... };
( let $name:ident = [ $head:expr , $($tail:expr),* ] ) => { ... };
}
Expand description
Convenient macro to define a stack list from a slice literal.
Note that this will actually define a bunch of local stack variables (one per item in the list). This is not an expression to define a standalone stack list, this would be impossible.
ยงExamples
stack_list::make!(let my_list = [1, 2, 3, 4]);
assert_eq!(my_list.len(), 4);
assert_eq!(my_list.get(3), Some(&4));
println!("{:?}", my_list);