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
use ForEachIntTypeInput;
use TokenStream;
use quote;
/// Takes as input a path to a macro and optional flags. Additionally, you can also add the `args:` or `each:`
/// modifiers to the beginning of the input in order to control how the macro is invoked. With `each:`, the macro
/// is invoked for each type. With `args:`, the macro is invoked with each type as input (without separators).
/// The default mode is `each:`.
/// # Example
/// ```rust,no_run
/// for_each_int_type!(each: path_to_macro);
/// // or
/// for_each_int_type!(args: path_to_macro);
/// // or
/// for_each_int_type!(path_to_macro; signed);
/// // or
/// for_each_int_type!(path_to_macro; signed !sized !(64, 128));
/// ```
/// # Flags
/// - `none`
/// - `all`
/// - `deterministic` (all types besides `isize` and `usize`)
/// - `sized` (`isize` and `usize`)
/// - `signed` (`i8`, `i16`, `i32`, `i64`, `i128`, and `isize`)
/// - `unsigned` (`u8`, `u16`, `u32`, `u64`, `u128`, and `usize`)
/// - `8` (`u8` and `i8`)
/// - `16` (`u16` and `i16`)
/// - `32` (`u32` and `i32`)
/// - `64` (`u64` and `i64`)
/// - `128` (`u128` and `i128`)
/// - `u8`
/// - `u16`
/// - `u32`
/// - `u64`
/// - `u128`
/// - `usize`
/// - `i8`
/// - `i16`
/// - `i32`
/// - `i64`
/// - `i128`
/// - `isize`
///
/// Each flag can be negated using `!`.
/// ```rust, no_run
/// for_each_int_type!(no_sized; all !sized);
/// ```
///
/// Flags can also be placed in groups, that can also be negated:
/// ```rust, no_run
/// for_each_int_type!(groups; signed !(isize i128) (u8 u16))
/// ```
/// When adding flags, you must add flags first for them to be active.
/// All flags start off inactive. A good initial flag is the `all` flag
/// so that you can negate the flags you don't want.