Commit ca425943e7
Unsigned
Layout: unified · split
src/config.rs +4 −10
| @@ -107,22 +107,16 @@ macro_rules! bool_create { | ||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | macro_rules! integer_create { |
| 110 | ($option_name:ident, $description:literal, $default:literal, $min:literal, $max:literal, [$($string_value:literal), *]) => { | |
| 110 | ($option_name:ident, $description:literal, $default:literal, $min:literal, $max:literal) => { | |
| 111 | 111 | paste::item! { |
| 112 | 112 | fn [<create_option_ $option_name>](section: &mut SectionHandleMut) { |
| 113 | let mut string_values: Vec<String> = Vec::new(); | |
| 114 | ||
| 115 | $( | |
| 116 | string_values.push($string_value.into()); | |
| 117 | )* | |
| 118 | ||
| 119 | 113 | let option_name = stringify!($option_name); |
| 114 | ||
| 120 | 115 | let option_settings = IntegerOptionSettings::new(option_name) |
| 121 | 116 | .description($description) |
| 122 | 117 | .default_value($default) |
| 123 | 118 | .min($min) |
| 124 | .max($max) | |
| 125 | .string_values(string_values); | |
| 119 | .max($max); | |
| 126 | 120 | |
| 127 | 121 | section.new_integer_option(option_settings) |
| 128 | 122 | .expect(&format!("Can't create option {}", option_name)); |
| @@ -193,7 +187,7 @@ macro_rules! option { | ||
| 193 | 187 | }; |
| 194 | 188 | |
| 195 | 189 | (Integer, $option_name:ident, $description:literal, $default:literal, $min:literal..$max:literal $(,)?) => { |
| 196 | integer_create!($option_name, $description, $default, $min, $max, []); | |
| 190 | integer_create!($option_name, $description, $default, $min, $max); | |
| 197 | 191 | option_getter!(Integer, $option_name, i64); |
| 198 | 192 | }; |
| 199 | 193 | |