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
//! Declarative macro for defining constant data, safely and concisely.
/// Declarative macro for defining constant data, safely and concisely.
///
/// The `const_data!` macro simplifies the definition of `const` items using expressive syntax
/// and automatic support for compile-time concatenation. It supports single values, strings, slices, arrays.
///
/// # Features
/// - Concatenates multiple `&'static str` literals at compile time.
/// - Merges slices and arrays (e.g., `[u8]`, `[T; N]`, `&[T]`) using safe const-evaluated logic.
/// - Supports named lifetimes.
/// - Works recursively, allowing multiple constants to be declared in a single block.
/// - Preserves visibility modifiers (`pub`, `pub(crate)`, etc).
///
/// # Supported Patterns
/// | Form | Behavior |
/// |-------------------------------|------------------------------------------------------|
/// | `const NAME: T = value;` | Defines a simple constant value |
/// | `const NAME: &str = a, b, c;` | Compile-time concat via `concat_str!` |
/// | `const NAME: &[$T] = a, b;` | Compile-time merges slices into new `&[$T]` via `concat_array!` |
/// | `const NAME: [$T; N] = a, b;` | Compile-time merges arrays into new `[T; N]` |
/// | `const NAME: &[$T; N] = ...;` | Creates referenced array literal |
///
/// # Example
/// ```rust
/// cluConstData::const_data! {
/// pub const HELLO: &str = "Hello, ", "world!";
/// const NUMS: [u8; 5] = &[1, 2], &[3, 4, 5];
/// const FLAGS: &[bool] = &[true], &[false];
/// }
/// ```
};
// concat_str: &'static str
=> ;
// concat_str: &str
=> ;
// concat_array: &[T] &[T; N]
=> ;
// concat_array: [T] [T; N]
=> ;
// END
=>
}