macro_rules! count_paren_items {
    (($($item:tt)*), $($remaining:tt)*) => { ... };
    (($($item:tt)*)) => { ... };
    () => { ... };
}
Expand description

Counts the number of parenthesis-delimited, comma-separated items.

Examples


assert_eq!(0, count_paren_items!());
assert_eq!(1, count_paren_items!((A)));
assert_eq!(1, count_paren_items!((A),));
assert_eq!(2, count_paren_items!((A), (B)));
assert_eq!(2, count_paren_items!((A), (B),));
assert_eq!(3, count_paren_items!((A), (B), (C)));
assert_eq!(3, count_paren_items!((A), (B), (C),));
This documentation is an old archive. Please see https://rust.docs.kernel.org instead.