Macro kernel::count_brace_items
source · [−]macro_rules! count_brace_items {
({$($item:tt)*}, $($remaining:tt)*) => { ... };
({$($item:tt)*}) => { ... };
() => { ... };
}
Expand description
Counts the number of comma-separated entries surrounded by braces.
Examples
assert_eq!(0, count_brace_items!());
assert_eq!(1, count_brace_items!({ A }));
assert_eq!(1, count_brace_items!({ A },));
assert_eq!(2, count_brace_items!({ A }, { B }));
assert_eq!(2, count_brace_items!({ A }, { B },));
assert_eq!(3, count_brace_items!({ A }, { B }, { C }));
assert_eq!(3, count_brace_items!({ A }, { B }, { C },));