std_macro_extensions/linked_list/macro.rs
1/// Creates a new `LinkedList` instance.
2///
3/// This macro can be used in two forms:
4/// - Without arguments, it creates an empty `LinkedList`.
5/// - With elements, it creates a `LinkedList` and appends the provided elements to the back of the list.
6#[macro_export]
7macro_rules! linked_list {
8 () => {
9 std::collections::LinkedList::new()
10 };
11 ($($elem:expr),*) => {{
12 std::collections::LinkedList::from([$($elem),*])
13 }};
14}