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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// Copyright © 2023-2026 Common (CMN) library. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Utility macros that eliminate common Rust boilerplate.
//!
//! Use these for quick min/max, range-checks, vector/map
//! construction, string splitting, and numeric parsing without
//! pulling in additional crate dependencies.
//!
//! ## Available macros
//!
//! | Macro | Description |
//! |--------|------------|
//! | `cmn` | The main macro for the cmn crate. It takes any number of arguments and parses them into a Rust value. |
//! | `cmn_assert` | Checks if the given expression is true. |
//! | `cmn_contains` | Checks if the given string contains the given substring. |
//! | `cmn_in_range` | Checks if the given value is in the given range. |
//! | `cmn_join` | Joins a vector of strings into a single string. |
//! | `cmn_map` | Creates a new map of the given key-value pairs. |
//! | `cmn_max` | Returns the maximum of the given values. |
//! | `cmn_min` | Returns the minimum of the given values. |
//! | `cmn_parse` | Parses the given input into a Rust value. |
//! | `cmn_print_vec` | Prints a vector of elements to the console. |
//! | `cmn_print` | Prints the arguments to the console. |
//! | `cmn_split` | Splits a string into a vector of words. |
//! | `cmn_to_num` | Converts the given string to a number. |
//! | `cmn_vec` | Creates a new vector of the given elements. |
//!
/// This macro takes any number of arguments and parses them into a
/// Rust value.
/// This macro asserts that the given condition is true. If the
/// condition is false, the macro panics with the given message.
/// This macro checks if the given string contains the given substring.
/// This macro checks if the given value is within the given range.
/// This macro joins the given strings together with the given separator.
/// This macro creates a new map of the given key-value pairs.
/// This macro finds the maximum value of the given values.
/// This macro finds the minimum value of the given values.
/// This macro prints the given arguments to the console.
/// This macro prints the given vector of values to the console.
/// This macro splits the given string into a vector of strings.
/// This macro converts the given string to a number.
/// This macro creates a new vector with the given elements.
/// This macro parses the given input into a Rust value.
/// This macro defines a set of constants with their corresponding
/// values. The macros can be used to define constants in a concise
/// and easy-to-read way.
// cmn_constants! {
// AVOGADRO = super::constants::AVOGADRO,
// BOLTZMANN = super::constants::BOLTZMANN,
// EULER = super::constants::EULER,
// GAMMA = super::constants::GAMMA,
// HASH_ALGORITHM = super::constants::HASH_ALGORITHM,
// HASH_COST = super::constants::HASH_COST,
// HASH_LENGTH = super::constants::HASH_LENGTH,
// PHI = super::constants::PHI,
// PI = super::constants::PI,
// PLANCK = super::constants::PLANCK,
// SILVER_RATIO = super::constants::SILVER_RATIO,
// SPECIAL_CHARS = super::constants::SPECIAL_CHARS,
// SQRT2 = super::constants::SQRT2,
// SQRT3 = super::constants::SQRT3,
// SQRT5 = super::constants::SQRT5,
// TAU = super::constants::TAU
// }