kernel

Macro count_expressions

Source
macro_rules! count_expressions {
    () => { ... };
    ($head:expr $(,)?) => { ... };
    ($head:expr, $($tail:expr),* $(,)?) => { ... };
}
Expand description

Count the number of passed expressions.

Useful for constructing variable sized arrays in other macros. Taken from the Little Book of Rust Macros.

use kernel:count_expressions;

let count: usize = count_expressions!(1+2, 3+4);