1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
pub
///////////////////////////////////
/// Constructs an [`NList`](crate::NList)
///
/// This macro can be used in two ways:
/// - `nlist![a, b, c]`: creates an NList with the listed elements
/// - `nlist![val; LEN]`: creates an NList by repeating a [`Copy`] value `LEN` times.
/// (`LEN` must be either a usize expression or `_`)
///
/// # Example
///
/// # List each element
///
/// ```rust
/// use nlist::{NList, Peano};
///
/// const LIST: NList<u32, Peano!(4)> = nlist::nlist![3, 5, 8, 13];
///
/// assert_eq!(LIST.into_vec(), vec![3, 5, 8, 13]);
///
/// ```
///
/// # Repeat elements
///
/// Repeating a [`Copy`] value to construct an [`NList`]
///
/// ```rust
/// use nlist::{NList, Peano};
///
/// // Inferring the length
/// let list_a: NList<u8, Peano!(2)> = nlist::nlist![5; _];
/// assert_eq!(list_a.into_array(), [5, 5]);
///
/// // Passing the length explicitly
/// let list_b: NList<&str, Peano!(3)> = nlist::nlist!["heh"; 3];
/// assert_eq!(list_b.into_array(), ["heh", "heh", "heh"]);
///
/// ```
///
/// [`Copy`]: core::marker::Copy
/// [`NList`]: crate::NList
///////////////////////////////////
/// Converts an integer constant to a [peano integer](crate::PeanoInt)
///
/// This macro is sugar for `<`[`FromUsize`]` as `[`PeanoInt`]`>::NEW`
///
/// # Example
///
/// ```rust
/// use nlist::{NList, nlist, Peano, peano};
///
/// let val_0: Peano!(0) = peano!(0);
/// let val_1: Peano!(1) = peano!(1);
/// let val_2: Peano!(2) = peano!(2);
/// let val_3: Peano!(3) = peano!(3);
/// ```
///
/// [`FromUsize`]: crate::peano::FromUsize
/// [`PeanoInt`]: crate::PeanoInt
/// Converts an integer constant to a [peano integer](crate::PeanoInt)
///
/// This macro is just sugar for the [`FromUsize`] type alias
///
/// # Example
///
/// ```rust
/// use nlist::{NList, nlist, Peano};
///
/// let list_0: NList<u8, Peano!(0)> = nlist![];
/// let list_1: NList<u8, Peano!(1)> = nlist![3];
/// let list_2: NList<u8, Peano!(2)> = nlist![3, 5];
/// let list_3: NList<u8, Peano!(3)> = nlist![3, 5, 8];
/// ```
///
/// [`FromUsize`]: crate::peano::FromUsize
}