Skip to main content

nya_macros/
lib.rs

1//! Utility macros
2
3/// Calls `macro` with all the parameters reducing the parameter count by 1 each time.
4///
5/// For example, `smaller_calls_too!(macro, A, B, C)` expands to
6/// ```rs
7/// macro!{A, B, C}
8/// macro!{A, B}
9/// macro!{A}
10/// ```
11#[macro_export]
12macro_rules! smaller_calls_too {
13    ($macro: ident, $next: tt) => {
14        $macro!{$next}
15    };
16    ($macro: ident, $next: tt, $($rest: tt),*) => {
17        $macro!{$next, $($rest),*}
18        $crate::smaller_calls_too!{$macro, $($rest),*}
19    }
20}