Skip to main content

im_lists/
lib.rs

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