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
/// Generates a list of tuples containing field names and their values
///
/// ## Example
///
/// ```
/// use testutils::generate_struct_arr;
///
/// struct BuildStd {
/// std: bool,
/// core: bool,
/// alloc: bool,
/// }
///
/// let b = BuildStd {
/// std: false,
/// core: true,
/// alloc: true,
/// };
///
/// let arr = generate_struct_arr![ b => core, alloc, std ];
/// assert_eq!(
/// arr,
/// [("core", true), ("alloc", true), ("std", false)]
/// );
/// ```
/// Generates a **static** `OnceLock` variable with the given name and type.
///
/// ## Example
///
/// ```
/// use testutils::new_once_lock;
///
/// fn static_a<'s>(n: u8) -> &'s u8 {
/// new_once_lock!(A: u8); // => static A: OnceLock<u8> = OnceLock::new();
/// A.get_or_init(|| n)
/// }
/// assert_eq!(static_a(3), &3);
/// assert_eq!(static_a(5), &3);
/// assert_eq!(static_a(42), &3);
/// ```