1 /// Helper function that appends extra documentation to [`crate::Builder`] methods that support regular
2 /// expressions in their input.
3 macro_rules! regex_option {
4     ($(#[$attrs:meta])* pub fn $($tokens:tt)*) => {
5         $(#[$attrs])*
6         ///
7         /// Regular expressions are supported. Check the [regular expression
8         /// arguments](./struct.Builder.html#regular-expression-arguments) section and the
9         /// [regex](https://docs.rs/regex) crate documentation for further information.
10         pub fn $($tokens)*
11     };
12 }
13 
14 /// Helper macro to set the default value of each option.
15 ///
16 /// This macro is an internal implementation detail of the `options` macro and should not be used
17 /// directly.
18 macro_rules! default {
19     () => {
20         Default::default()
21     };
22     ($expr:expr) => {
23         $expr
24     };
25 }
26 
27 /// Helper macro to set the conversion to CLI arguments for each option.
28 ///
29 /// This macro is an internal implementation detail of the `options` macro and should not be used
30 /// directly.
31 macro_rules! as_args {
32     ($flag:literal) => {
33         |field, args| AsArgs::as_args(field, args, $flag)
34     };
35     ($expr:expr) => {
36         $expr
37     };
38 }
39 
40 /// Helper function to ignore an option when converting it into CLI arguments.
41 ///
42 /// This function is only used inside `options` and should not be used in other contexts.
ignore<T>(_: &T, _: &mut Vec<String>)43 pub(super) fn ignore<T>(_: &T, _: &mut Vec<String>) {}
44