im_lists/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod handler;
4pub mod list;
5pub mod shared;
6pub(crate) mod unrolled;
7
8/// Construct a [`List`](crate::list::List) from a sequence of elements
9#[macro_export]
10macro_rules! list {
11    () => { $crate::list::List::new() };
12
13    ( $($x:expr),+ $(,)? ) => {{
14        vec![$(
15            $x,
16        ) *].into_iter().collect::<$crate::list::List<_>>()
17    }};
18
19    ( $($x:expr ,)+ $(,)? ) => {{
20        vec![$($x)*].into_iter().collect::<$crate::list::List<_>>()
21    }};
22}
23
24/// Construct a [`VList`](crate::list::VList) from a sequence of elements
25#[macro_export]
26macro_rules! vlist {
27    () => { $crate::list::VList::new() };
28
29    ( $($x:expr),+ $(,)? ) => {{
30        vec![$(
31            $x,
32        ) *].into_iter().collect::<$crate::list::VList<_>>()
33    }};
34
35    ( $($x:expr ,)+ $(,)? ) => {{
36        vec![$($x)*].into_iter().collect::<$crate::list::VList<_>>()
37    }};
38}
39
40/// Construct a [`SharedList`](crate::list::SharedList) from a sequence of elements
41#[macro_export]
42macro_rules! shared_list {
43    () => { $crate::list::SharedList::new() };
44
45    ( $($x:expr),+ $(,)? ) => {{
46        vec![$(
47            $x,
48        ) *].into_iter().collect::<$crate::list::SharedList<_>>()
49    }};
50
51    ( $($x:expr ,)+ $(,)? ) => {{
52        vec![$($x)*].into_iter().collect::<$crate::list::SharedList<_>>()
53    }};
54}
55
56/// Construct a [`SharedList`](crate::list::SharedList) from a sequence of elements
57#[macro_export]
58macro_rules! shared_vlist {
59    () => { $crate::list::SharedVList::new() };
60
61    ( $($x:expr),+ $(,)? ) => {{
62        vec![$(
63            $x,
64        ) *].into_iter().collect::<$crate::list::SharedVList<_>>()
65    }};
66
67    ( $($x:expr ,)+ $(,)? ) => {{
68        vec![$($x)*].into_iter().collect::<$crate::list::SharedVList<_>>()
69    }};
70}